Working with Modules
Default Export Function
A default export is the single main value a module exposes.
Default Export Function
default_export.ts
export default function titleCase(text: string): string {
return text
.split(" ")
.map((word) => word[0].toUpperCase() + word.slice(1))
.join(" ");
}
const rawTitle: string = ;
const title: string = titleCase(rawTitle);
console.log(title);
export default function titleCase(text: string): string {
return text
.split(" ")
.map((word) => word[0].toUpperCase() + word.slice(1))
.join(" ");
}
const rawTitle: string = ;
const title: string = titleCase(rawTitle);
console.log(title);
default export
`export default` marks one declaration as the primary export of the module.