A named export makes a value available from a module under a specific name. Use it when a module exposes several values that callers should choose explicitly. In ESM, `export const homeIsland = "Tsushima"` and `export function getOccupation(...)` create two named exports; an importer selects them inside braces. section 13.1.1
Listing 13.2 Importing named values
import { #A
homeIsland, #A
getOccupation as getTitle, #A
} from "./1-export-syntax.ts"; #A
console.assert(
homeIsland === "Tsushima",
"The home island is Tsushima",
);
console.assert(
getTitle("Yotei") === "Ghost of Yotei",
"The protector of Yotei is a ghost",
);The import keeps `homeIsland` under its exported name but uses `as` to call `getOccupation` by the local name `getTitle`. Aliasing also resolves clashes between imports with the same name. section 13.1.1
Named and default exports can coexist. A default import appears before the braces containing named imports; a namespace import instead collects the module’s exports for access as properties. The `from` path is resolved by the runtime or compiler, not prescribed by ESM: Node’s ESM imports require file extensions, while TypeScript settings affect which extensions are accepted. section 13.1.1
An exported value that changes
A module exports `rollDice` and `lastDiceRoll`. Each call to `rollDice` reassigns `lastDiceRoll` in that module, and an importer reading `lastDiceRoll` sees the updated value. This is a live binding, not a copied snapshot. The importer cannot reassign it; the exporting module can. section 13.1.1 section 13.4


