microsoft-typescript
Skill308 starsChanged 7 months agoMITView on GitHub
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.
In this repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- bombshell-dev-clackSkill
- sindresorhus-log-updateSkill
- sqlite-vec-skilldSkill
- unjs-cittySkill
- generate-package-skillSkill
- generate-project-skillSkill
- review-skillSkill
- skilldSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 21
Use skilld search "query" -p typescript instead of grepping .skilld/ directories.
- Very specific: line 64
Use lowercase primitive type names (string, number, boolean, symbol) rather than capitalized versions (String, Number, Boolean, Symbol), …
- Very specific: line 66
Avoid any unless actively migrating JavaScript to TypeScript.
- Very specific: line 68
Use void for callback return types when the return value will be ignored.
- Distinctive: line 77
Write callback parameters as required rather than optional unless you specifically need to allow invocation with fewer arguments.
- Distinctive: line 81
Use optional parameters instead of multiple overloads that differ only in trailing parameters.
- Distinctive: line 83
Use union types instead of overloads when signatures differ only in the type of a single argument.
- Distinctive: line 85
Avoid writing generic types that don't use their type parameter, as unused generics provide no type safety benefit and confuse readers …
- Very specific: line 103
Use utility types like Pick, Omit, Partial, Required, and Record to transform existing types instead of manually rewriting object shapes.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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
Search
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 -->API Changes
This section documents version-specific API changes for TypeScript v5.7+, prioritizing recent major/minor releases.
- BREAKING:
ArrayBufferno longer supertype ofTypedArraytypes — v5.9 changedArrayBufferrelationships; methods expectingArrayBuffernow rejectUint8Array,Buffer, etc. Fix by accessing.bufferproperty or using specificUint8Array<ArrayBuffer>types source - 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 - BREAKING:
TypedArraygenerics overArrayBufferLike— v5.7+ made allTypedArraytypes generic (Uint8Array<TArrayBuffer>), breaking code passingBuffer/Uint8ArraywhereArrayBufferexpected. Update@types/nodeand specify explicit buffer type or use.bufferproperty source - NEW:
--module node20— v5.9 stable option modeling Node.js v20 behavior; unlikenodenext, implies--target es2023and is not floating. Use when locked to Node.js v20 source - NEW:
--erasableSyntaxOnlyoption — v5.8 flag for Node.js 23.6+--experimental-strip-typesmode; errors on non-erasable TypeScript constructs (enum,namespacewith code, parameter properties,import =,export =) source - NEW:
--module node18— v5.8 stable option for Node.js 18; disallowsrequire()of ESM but allows import assertions (unlikenodenext) source - NEW:
require()of ECMAScript modules — v5.8--module nodenextnow permitsrequire("esm")from CommonJS (Node.js 22+), except for ESM with top-levelawaitsource - BREAKING: Import assertions deprecated in
--module nodenext— v5.8 rejectsassert { type: "json" }syntax in favor ofwith { type: "json" }source - NEW:
--rewriteRelativeImportExtensionsoption — v5.7 compiler option rewrites relative.tsimports to.jswhen emitting, enabling in-place execution then compilation source - NEW:
--target es2024and--lib es2024— v5.7 support for ES2024 features (Object.groupBy,Map.groupBy,Promise.withResolvers,SharedArrayBuffertypes) source - NEW: Granular return expression checking — v5.8 type-checks each branch of conditional
returnstatements against declared return type, catching type mismatches withanycorruption source - BREAKING: JSON import validation in
--module nodenext— v5.7 requireswith { type: "json" }attribute for JSON imports; no named exports, only default source - NEW:
--libReplacementflag — v5.8 option to disable/enable@typescript/lib-*package lookup; default behavior may change in future versions source - BREAKING: Index signatures from non-literal class methods — v5.7 now generates index signatures for non-literal computed method names (e.g.,
[symbolName]() {}), changing class type shape source - NEW: Preserved computed property names in declarations — v5.8 preserves entity names (bare variables, dotted names) in computed property declarations in classes source
Also 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 -->Best Practices
- Use lowercase primitive type names (
string,number,boolean,symbol) rather than capitalized versions (String,Number,Boolean,Symbol), which refer to boxed objects rarely used in JavaScript code source - Avoid
anyunless actively migrating JavaScript to TypeScript; preferunknownwhen the input type is truly unknown, as it forces explicit type checking before use source - Use
voidfor 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
}- Write callback parameters as required rather than optional unless you specifically need to allow invocation with fewer arguments; optional parameters create misleading contracts about how the callback can be called source
- Order function overloads from specific signatures to general ones; TypeScript selects the first matching overload, so more specific cases must come before general ones source
- Use optional parameters instead of multiple overloads that differ only in trailing parameters; this enables better error detection in higher-order functions and respects strict null checks source
- Use union types instead of overloads when signatures differ only in the type of a single argument; union signatures enable "pass-through" patterns where values can be forwarded without losing type information source
- Avoid writing generic types that don't use their type parameter, as unused generics provide no type safety benefit and confuse readers about intent source
- Enable strict compiler options in
tsconfig.json:strict,noUncheckedIndexedAccess,exactOptionalPropertyTypes, andverbatimModuleSyntaxcatch real bugs at compile time rather than runtime source
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force"
}
}- Rely on contextual typing to infer callback parameter types rather than explicitly annotating each one; TypeScript infers parameter types from the context in which the callback is used, reducing boilerplate source
- Use utility types like
Pick,Omit,Partial,Required, andRecordto transform existing types instead of manually rewriting object shapes; these compose reliably and reduce duplication source - Provide explicit type annotations for array/collection literals when TypeScript's "best common type" algorithm fails; this is necessary when array elements have no single common base type across all candidates 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 -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

