A default export is the single main value a module exposes.

default export `export default` marks one declaration as the primary export of the module.

Default Export Function

rawTitle
default_export.ts
Replay: real traced execution (multi-file project)
export default function titleCase(text: string): string {
    return text
        .split(" ")
        .map((word) => word[0].toUpperCase() + word.slice(1))
        .join(" ");
}

const rawTitle: string = "trace replay";
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 = "module boundary";
const title: string = titleCase(rawTitle);

console.log(title);
  1. rawTitle ← trace replay

    5        .join(" ");6}78const rawTitle→ trace replay: string = "trace replay";  //@rawTitle="module boundary"9const title: string = titleCase(rawTitletrace replay);
  2. export default function titleCase(text: string): string

    1export default function titleCase(texttrace replay: string): string {2    return texttrace replay3        .split(" ")4        .map((word) => word[0].toUpperCase() + word.slice(1))5        .join(" ");6}
  3. title ← Trace Replay

    8const rawTitle: string = "trace replay";  //@rawTitle="module boundary"9const title→ Trace Replay: string = titleCase(rawTitletrace replay);1011console.log(titleTrace Replay);
    outputTrace Replay
  1. rawTitle ← module boundary

    5        .join(" ");6}78const rawTitle→ module boundary: string = "module boundary";9const title: string = titleCase(rawTitlemodule boundary);
  2. export default function titleCase(text: string): string

    1export default function titleCase(textmodule boundary: string): string {2    return textmodule boundary3        .split(" ")4        .map((word) => word[0].toUpperCase() + word.slice(1))5        .join(" ");6}
  3. title ← Module Boundary

    8const rawTitle: string = "module boundary";9const title→ Module Boundary: string = titleCase(rawTitlemodule boundary);1011console.log(titleModule Boundary);
    outputModule Boundary