Install
openclaw skills install typescriptWrite type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.
openclaw skills install typescriptUser needs TypeScript expertise — from basic typing to advanced generics. Agent handles type narrowing, inference, discriminated unions, and strict mode patterns.
| Topic | File |
|---|---|
| Generic patterns | generics.md |
| Utility types | utility-types.md |
| Declaration files | declarations.md |
| Migration from JS | migration.md |
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 path