Problem Statement
Preferred organization for modern TS:
Explanation
Use ES modules (`import`/`export`) for clear boundaries, tree-shaking, and compatibility with modern bundlers and runtimes. Namespaces and globals are legacy patterns and make code harder to split.
Code Solution
SolutionRead Only
// math.ts
export const add = (a: number, b: number) => a + b;
// app.ts
import { add } from './math.js';
console.log(add(2,3));