Skip to main content

Posts

Showing posts with the label What is export?

TypeScript - Export vs. Default Exports

What is export in TypeScript? Why using export in  TypeScript ? Export - Exporting a declaration Any variable, function, class or interface can be exported by using the export keyword. After using export keyword, you can access your variable, function, class or interface to outside the module. Example – module System.modules { //this function can be accessed from outside the module because using export. export function addNumbers(a: number , b: number ) : number { return a + b; } // this class can be accessed from outside the module becaues using export. export class ExportedClass { public subNumbers(a: number , b: number ) : number { return a - b; } } } //AND namespace System.namespaces { //this function can be accessed from outside the module because using export. export function addNumbers(a: number , b: number ) : number { return a + b; } // this class ca...