Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.
Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Summarize what changed and any follow-up checks I should run.
User needs TypeScript expertise โ from basic typing to advanced generics. Agent handles type narrowing, inference, discriminated unions, and strict mode patterns.
TopicFileGeneric patternsgenerics.mdUtility typesutility-types.mdDeclaration filesdeclarations.mdMigration from JSmigration.md
unknown forces you to narrow before use โ any silently breaks type safety API responses: type them or use unknown, never any When you don't know the type, that's unknown, not any
filter(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 keys Array.isArray() narrows to any[] โ may need assertion for element type in operator narrows but only if property is in exactly one branch of union
let x = "hello" is string โ use const or as const for literal type Object properties widen: { status: "ok" } has status: string โ use as const or type annotation Function return types widen โ annotate explicitly for literal returns
Callbacks lose inference in some array methods โ annotate parameter when TS guesses wrong Generic functions need usage to infer โ fn<T>() can't infer, pass a value or annotate Nested generics often fail โ break into steps with explicit types
Add a literal type or kind field to each variant โ enables exhaustive switch Exhaustive check: default: const _never: never = x โ compile error if case missed Don't mix discriminated with optional properties โ breaks narrowing
const x: Type = val widens to Type โ loses literal info const x = val satisfies Type keeps literal, checks compatibility โ prefer for config objects
Optional chaining ?. returns undefined, not null โ matters for APIs expecting null ?? only catches null/undefined โ || catches all falsy including 0 and "" Non-null ! should be last resort โ prefer narrowing or early return
import type for type-only imports โ stripped at runtime, avoids bundler issues Re-exporting types: export type { X } โ prevents accidental runtime dependency .d.ts augmentation: use declare module with exact module path
Code helpers, APIs, CLIs, browser automation, testing, and developer operations.
Largest current source with strong distribution and engagement signals.