TypeScript 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.
npx skills add https://github.com/skilld-dev/skilld --skill microsoft-typescript
typescript> TypeScript is a language for application scale JavaScript development
Version: 6.0.2
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
References: package.json — exports, entry points • README — setup, basic usage • Docs — API reference, guides • GitHub Issues — bugs, workarounds, edge cases • Releases — changelog, breaking changes, new APIs
Use skilld search "query" -p typescript instead of grepping .skilld/ directories. Run skilld search --guide -p typescript for full syntax, filters, and operators.
<!-- skilld:api-changes -->
This section documents version-specific API changes for TypeScript v5.7+, prioritizing recent major/minor releases.
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 sourceimport 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 sourceTypedArray 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--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--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--module node18 — v5.8 stable option for Node.js 18; disallows require() of ESM but allows import assertions (unlike nodenext) sourcerequire() of ECMAScript modules — v5.8 --module nodenext now permits require("esm") from CommonJS (Node.js 22+), except for ESM with top-level await source--module nodenext — v5.8 rejects assert { type: "json" } syntax in favor of with { type: "json" } source--rewriteRelativeImportExtensions option — v5.7 compiler option rewrites relative .ts imports to .js when emitting, enabling in-place execution then compilation source--target es2024 and --lib es2024 — v5.7 support for ES2024 features (Object.groupBy, Map.groupBy, Promise.withResolvers, SharedArrayBuffer types) sourcereturn statements against declared return type, catching type mismatches with any corruption source--module nodenext — v5.7 requires with { type: "json" } attribute for JSON imports; no named exports, only default source--libReplacement flag — v5.8 option to disable/enable @typescript/lib-* package lookup; default behavior may change in future versions sourcesymbolName {}), changing class type shape sourceAlso changed: Checks for never-initialized variables (v5.7) · Minimal tsc --init output (v5.9) · Type argument inference changes may introduce new errors (v5.9) · V8 compile caching in Node.js (v5.7) · More implicit any errors on functions returning null/undefined (v5.7) · Expandable hovers preview (v5.9) · Configurable hover length js/ts.hover.maximumLength (v5.9) · Search ancestor tsconfig.json files (v5.7) · Faster project ownership checks for composite projects (v5.7)
<!-- /skilld:api-changes -->
<!-- skilld:best-practices -->
string, number, boolean, symbol) rather than capitalized versions (String, Number, Boolean, Symbol), which refer to boxed objects rarely used in JavaScript code sourceany unless actively migrating JavaScript to TypeScript; prefer unknown when the input type is truly unknown, as it forces explicit type checking before use sourcevoid for callback return types when the return value will be ignored; this prevents accidental access to the return value and catches real bugs source// Good - prevents accidental use of return value
function fn(x: () => void) {
x(); // return value is ignored
}
tsconfig.json: strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, and verbatimModuleSyntax catch real bugs at compile time rather than runtime source{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force"
}
}
Pick, Omit, Partial, Required, and Record to transform existing types instead of manually rewriting object shapes; these compose reliably and reduce duplication source// TypeScript infers (Rhino | Elephant | Snake)[] without annotation
// Explicit annotation needed to get Animal[]
const zoo: Animal[] = [new Rhino(), new Elephant(), new Snake()]
<!-- /skilld:best-practices -->
Take skilld-dev/microsoft-typescript from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.