TypeScript Default Exports

TypeScript Default Exports - What is default exports?

What is default export in TypeScript? Why we use it?

Default exports –
Each module can optionally export a default export and the default exports work with the keyword default and we can use only one default export per module.

Example -

export class User {
    //Todo your logic here..
}
And then -
import { User } from "./User";

//OR

//BaseUrl.ts
export default "http://localhost:57431/Account/Login";

//Login.ts
import BaseUrl from "../BaseUrl";
console.log(BaseUrl); //"http://localhost:57431/Account/Login"

Stayed Informed – Learn Angular 2 with TypeScript

I hope you are enjoying with this post! Please share with you friends. Thank you!!
ANIL SINGH

Anil Singh is an author, tech blogger, and software programmer. Book writing, tech blogging is something do extra and Anil love doing it. For more detail, kindly refer to this link..

My Tech Blog - https://www.code-sample.com/
My Books - Book 1 and Book 2

www.code-sample.com/. Powered by Blogger.
^