TypeScript
Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.
New
Join 0+ developers using this skill
skill
Development & Code Tools
intermediate
Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.
Real data. Real impact.
Emerging
Developers
Per week
Open source
Skills give you superpowers. Install in 30 seconds.
User needs TypeScript expertise — from basic typing to advanced generics. Agent handles type narrowing, inference, discriminated unions, and strict mode patterns.
| Topic | File |
|---|---|
| Generic patterns | |
| Utility types | |
| Declaration files | |
| Migration from JS | |
anyunknown forces you to narrow before use — any silently breaks type safetyunknown, never anyunknown, not anyfilter(Boolean) doesn't narrow — use .filter((x): x is T => Boolean(x))Object.keys(obj) returns string[], not keyof typeof obj — intentional, objects can have extra keysArray.isArray() narrows to any[] — may need assertion for element typein operator narrows but only if property is in exactly one branch of unionlet x = "hello" is string — use const or as const for literal type{ status: "ok" } has status: string — use as const or type annotationfn<T>() can't infer, pass a value or annotatetype or kind field to each variant — enables exhaustive switchdefault: const _never: never = x — compile error if case missedsatisfies vs Type Annotationconst x: Type = val widens to Type — loses literal infoconst x = val satisfies Type keeps literal, checks compatibility — prefer for config objects?. returns undefined, not null — matters for APIs expecting null?? only catches null/undefined — || catches all falsy including 0 and ""! should be last resort — prefer narrowing or early returnimport type for type-only imports — stripped at runtime, avoids bundler issuesexport type { X } — prevents accidental runtime dependency.d.ts augmentation: use declare module with exact module pathNo automatic installation available. Please visit the source repository for installation instructions.
View Installation Instructions1,500+ AI skills, agents & workflows. Install in 30 seconds. Part of the Torly.ai family.
© 2026 Torly.ai. All rights reserved.