Modules, Runtime & Tooling
Transpilation Targets & Polyfills
Transpilation rewrites syntax for older runtimes; polyfills provide missing runtime APIs. They solve different compatibility problems and are easy to confuse.
- Transpilation rewrites syntax
- Polyfills provide APIs
- Type declarations are not runtime support
- Targets should reflect supported environments
- Polyfills affect global behavior
| Tool | Solves | Does not solve |
|---|---|---|
| Transpilation | Unsupported syntax | Missing built-in APIs |
| Polyfill | Missing global/runtime API | Syntax parsing errors |
| Ponyfill | Local implementation | Global compatibility expectations |
| Browserslist/target | Environment selection | Actual user measurement |
| tsconfig lib | Compile-time API types | Runtime support |
// Syntax can be transpiled:
const name = user?.profile?.name ?? "Unknown"
// Missing API needs runtime support or polyfill:
const copy = structuredClone(value)