$npx -y skills add skilld-dev/skilld --skill microsoft-typescriptTypeScript is a language for application scale JavaScript development. ALWAYS use when editing or working with *.ts, *.tsx, *.mts, *.cts files or code importing \"typescript\". Consult for debugging, best practices, or modifying typescript, TypeScript.
| 1 | # microsoft/TypeScript `typescript` |
| 2 | |
| 3 | > TypeScript is a language for application scale JavaScript development |
| 4 | |
| 5 | **Version:** 6.0.2 |
| 6 | **Tags:** dev: 3.9.4, tag-for-publishing-older-releases: 4.1.6, insiders: 4.6.2-insiders.20220225, latest: 6.0.2, beta: 6.0.0-beta, rc: 6.0.1-rc, next: 6.0.0-dev.20260323 |
| 7 | |
| 8 | **References:** [package.json](./.skilld/pkg/package.json) — exports, entry points • [README](./.skilld/pkg/README.md) — setup, basic usage • [Docs](./.skilld/docs/_INDEX.md) — API reference, guides • [GitHub Issues](./.skilld/issues/_INDEX.md) — bugs, workarounds, edge cases • [Releases](./.skilld/releases/_INDEX.md) — changelog, breaking changes, new APIs |
| 9 | |
| 10 | ## Search |
| 11 | |
| 12 | Use `skilld search "query" -p typescript` instead of grepping `.skilld/` directories. Run `skilld search --guide -p typescript` for full syntax, filters, and operators. |
| 13 | |
| 14 | <!-- skilld:api-changes --> |
| 15 | ## API Changes |
| 16 | |
| 17 | This section documents version-specific API changes for TypeScript v5.7+, prioritizing recent major/minor releases. |
| 18 | |
| 19 | - BREAKING: `ArrayBuffer` no longer supertype of `TypedArray` types — v5.9 changed `ArrayBuffer` relationships; methods expecting `ArrayBuffer` now reject `Uint8Array`, `Buffer`, etc. Fix by accessing `.buffer` property or using specific `Uint8Array<ArrayBuffer>` types [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-9.html.md#libdts-changes) |
| 20 | |
| 21 | - NEW: `import defer * as ns from "module"` — v5.9 syntax for deferred module evaluation; module loading deferred until namespace accessed, useful for conditional/lazy imports. Only supports namespace imports, not named/default exports [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-9.html.md#support-for-import-defer) |
| 22 | |
| 23 | - BREAKING: `TypedArray` generics over `ArrayBufferLike` — v5.7+ made all `TypedArray` types generic (`Uint8Array<TArrayBuffer>`), breaking code passing `Buffer`/`Uint8Array` where `ArrayBuffer` expected. Update `@types/node` and specify explicit buffer type or use `.buffer` property [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-7.html.md#typedarrays-are-now-generic-over-arraybufferlike) |
| 24 | |
| 25 | - NEW: `--module node20` — v5.9 stable option modeling Node.js v20 behavior; unlike `nodenext`, implies `--target es2023` and is not floating. Use when locked to Node.js v20 [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-9.html.md#support-for---module-node20) |
| 26 | |
| 27 | - NEW: `--erasableSyntaxOnly` option — v5.8 flag for Node.js 23.6+ `--experimental-strip-types` mode; errors on non-erasable TypeScript constructs (`enum`, `namespace` with code, parameter properties, `import =`, `export =`) [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-8.html.md#the---erasablesyntaxonly-option) |
| 28 | |
| 29 | - NEW: `--module node18` — v5.8 stable option for Node.js 18; disallows `require()` of ESM but allows import assertions (unlike `nodenext`) [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-8.html.md#--module-node18) |
| 30 | |
| 31 | - NEW: `require()` of ECMAScript modules — v5.8 `--module nodenext` now permits `require("esm")` from CommonJS (Node.js 22+), except for ESM with top-level `await` [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-8.html.md#support-for-require-of-ecmascript-modules-in---module-nodenext) |
| 32 | |
| 33 | - BREAKING: Import assertions deprecated in `--module nodenext` — v5.8 rejects `assert { type: "json" }` syntax in favor of `with { type: "json" }` [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-8.html.md#restrictions-on-import-assertions-under---module-nodenext) |
| 34 | |
| 35 | - NEW: `--rewriteRelativeImportExtensions` option — v5.7 compiler option rewrites relative `.ts` imports to `.js` when emitting, enabling in-place execution then compilation [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-7.html.md#path-rewriting-for-relative-paths) |
| 36 | |
| 37 | - NEW: `--target es2024` and `--lib es2024` — v5.7 support for ES2024 features (`Object.groupBy`, `Map.groupBy`, `Promise.withResolvers`, `SharedArrayBuffer` types) [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-7.html.md#support-for---target-es2024-and---lib-es2024) |
| 38 | |
| 39 | - NEW: Granular return expression checking — v5.8 type-checks each branch of conditional `return` statements against declared return type, catching type mismatches with `any` corruption [source](./.skilld/docs/docs/handbook/release-notes/typescript-5-8.html.md#granular-checks-for-branches-in-return-expressions) |
| 40 | |
| 41 | - BREAKING: JSON import validation in `--module nodenext` — v5.7 requires `with { type: "json" }` attribute for JSON imports; no named exports, only default [source](./.skilld/docs/docs |