| name | typescript-skilld |
| description | 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. |
| metadata | {"version":"6.0.3","generated_by":"Anthropic · Haiku 4.5","generated_at":"2026-06-26T00:00:00.000Z"} |
microsoft/TypeScript typescript@6.0.3
Tags: dev: 3.9.4, tag-for-publishing-older-releases: 4.1.6, insiders: 4.6.2-insiders.20220225
References: package.json • README • Docs • Issues • Releases
Search
Use skilld search "query" -p typescript instead of grepping .skilld/ directories. Run skilld search --guide -p typescript for full syntax, filters, and operators.
API Changes
This section documents version-specific API changes — prioritize recent major/minor releases.
Breaking Changes (v5.9 → v6.0)
-
BREAKING: import ... asserts — replaced by import ... with for import attributes in v6.0. Code using asserts syntax now errors source
-
BREAKING: --module amd, umd, systemjs, none — removed in v6.0, only esnext, commonjs, nodenext, bundler, and preserve supported source
-
BREAKING: --outFile — removed in v6.0, must use external bundler instead source
-
BREAKING: module Foo { } namespace syntax — v6.0 errors on legacy module syntax, must use namespace Foo { } instead source
-
BREAKING: /// <reference no-default-lib="true"/> directive — removed in v6.0, use --noLib or --libReplacement instead source
Compiler Option Changes (Defaults)
-
BREAKING: types defaults to [] in v6.0 (was wildcard enumeration of node_modules/@types in v5.9) — must explicitly set "types": ["node", "jest"] or similar source
-
BREAKING: rootDir defaults to . in v6.0 (was inferred from source files in v5.9) — may need explicit "rootDir": "./src" if files are nested source
-
BREAKING: strict now defaults to true in v6.0 (was false in v5.9) — older projects must set "strict": false to preserve v5.9 behavior source
-
BREAKING: module defaults to esnext in v6.0 (was commonjs in v5.9) — projects targeting CommonJS must set "module": "commonjs" explicitly source
-
BREAKING: target defaults to es2025 in v6.0 (was es3 in v5.9) — only affects output runtime features; set explicit target for legacy runtimes source
Deprecated Compiler Options
-
DEPRECATED: --target es5 — v6.0 will error on target: es5, lowest allowed is es2015; use external compiler for ES5 output source
-
DEPRECATED: --moduleResolution node/node10 — v6.0 deprecates this; migrate to nodenext (Node.js) or bundler (bundlers/Bun) source
-
DEPRECATED: --downlevelIteration — v6.0 deprecates since it only affects ES5 emit (which is also deprecated) source
-
DEPRECATED: --baseUrl — v6.0 deprecates as lookup root; use paths with explicit prefixes instead (e.g., "@app/*": ["./src/app/*"]) source
-
DEPRECATED: --esModuleInterop false, --allowSyntheticDefaultImports false — v6.0 no longer allows false; interop behavior always enabled source
-
DEPRECATED: --moduleResolution classic — removed in v6.0; use nodenext or bundler source
-
DEPRECATED: --alwaysStrict false — v6.0 deprecates; all code assumed strict mode source
New Features (v6.0)
-
NEW: --stableTypeOrdering flag — v6.0 adds to match v7.0 type ordering (experimental, adds ~25% perf cost) for migration testing source
-
NEW: es2025 target and lib — v6.0 adds ES2025 standard support with RegExp.escape, Promise.try, Iterator methods source
-
NEW: Temporal API types — v6.0 includes stage-4 Temporal proposal types in esnext.temporal lib source
-
NEW: Map.prototype.getOrInsert(), Map.prototype.getOrInsertComputed() — v6.0 adds ES upsert methods for convenience get-or-default source
-
NEW: RegExp.escape() — v6.0 adds static method to escape special characters in regex patterns (ES2025) source
Module Resolution Changes (v6.0)
-
NEW: #/ subpath imports — v6.0 supports Node.js subpath imports starting with #/ in package.json imports field source
-
NEW: --moduleResolution bundler with --module commonjs — v6.0 allows this combination (previously only with esnext/preserve) source
Type System Improvements (v6.0)
- IMPROVED: Context-insensitive
this-less functions in type inference — v6.0 skips functions with no this usage during inference, allowing order-independent type resolution source
Library Changes (v6.0)
- BREAKING: DOM lib consolidated — v6.0 merges
dom.iterable and dom.asynciterable into dom; only need "lib": ["dom"] for iteration methods source
Recent Changes (v5.9)
-
NEW: import defer * as module syntax — v5.9 adds deferred module evaluation (stage 4 proposal); modules only execute on first property access source
-
NEW: --module node20 — v5.9 adds stable Node.js v20 target (unlike floating nodenext) with --target es2023 default source
-
BREAKING: ArrayBuffer type hierarchy — v5.9 breaks; ArrayBuffer no longer supertype of TypedArray/Buffer, requires explicit .buffer or Uint8Array<ArrayBuffer> source
Also changed: ignoreDeprecations: "6.0" disables deprecation errors for v6.0-only settings · tsc --ignoreConfig skips tsconfig.json · tsc --init generates minimal config · Hover length now configurable · expandable hovers (preview) · improved DOM API descriptions
Best Practices
-
Use lowercase string, number, boolean, and symbol types instead of capitalized versions (String, Number, Boolean, Symbol) — the capitalized versions refer to boxed objects which are almost never used in JavaScript code source
-
Use void as the return type for callback functions whose return value will be ignored — this prevents accidental use of the return value and provides type safety that any cannot offer source
-
Define generic type constraints with extends to enforce requirements on type parameters instead of using any — this maintains type safety while allowing flexibility source
interface Lengthwise { length: number }
function loggingIdentity<T extends Lengthwise>(arg: T): T {
console.log(arg.length)
return arg
}
-
Use unknown instead of any when accepting values of any type but you intend to perform type checking before using them — this preserves type safety and forces explicit type guards source
-
Use union types in function parameters instead of multiple overloads when type changes across parameters — this improves type inference and correctness for higher-order functions source
interface Moment {
utcOffset(): number
utcOffset(b: number | string): Moment
}
-
Order function overloads from most specific signatures to least specific — TypeScript uses the first matching overload, so general overloads placed first will hide more specific ones source
-
Replace multiple overloads that differ only in trailing parameters with optional parameters — this aligns with function signature compatibility rules and supports strict null checking correctly source
-
Use Readonly<T> utility type to document immutability contracts and pair with Object.freeze() for runtime enforcement — this prevents accidental mutations at the type level source
-
Use Pick<T, Keys> and Omit<T, Keys> to derive focused types from existing interfaces rather than duplicating property definitions — this maintains a single source of truth and reduces maintenance burden source
-
Use arrow functions for callbacks in object methods to capture this binding automatically instead of using regular functions and .bind() — this prevents common this context errors and is more concise source
let deck = {
suits: ["hearts", "spades"],
createCardPicker: function () {
return () => {
return this.suits[0]
}
}
}
-
Specify explicit this parameter types in method signatures to enable type checking of context — this catches binding errors at compile time rather than runtime source
-
Avoid heterogeneous enums mixing string and numeric values unless specifically leveraging JavaScript runtime behaviour — consistency in enum value types improves readability and reduces confusion source
-
Declare inferred class properties with JSDoc @type annotations in JavaScript files when types cannot be inferred from assignments — this provides explicit type control without requiring migration to TypeScript source