Typescript advanced
Skill pantheon-org/tekhne/skills/development/typescript-advanced
Comprehensive TypeScript guidance covering compiler configuration, advanced types, utility types, type guards, strict mode workflows, and documentation patterns; use when configuring tsconfig, designing complex generics, making illegal states unrepresentable, fixing type errors, or writing testable and maintainable type-safe APIs.From its SKILL.md
npx -y skills add pantheon-org/tekhne --skill typescript-advancedAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 9 stars9 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.7 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it
TypeScript Advanced
Comprehensive TypeScript guidance covering compiler configuration, advanced types, utilities, type narrowing, best practices, and documentation patterns.
When to Apply
Use this skill when:
- Configuring TypeScript compiler (tsconfig.json)
- Working with advanced type features (generics, conditionals, mapped types)
- Creating custom utility types and type guards
- Implementing type-first development workflow
- Making illegal states unrepresentable with discriminated unions
- Implementing runtime validation with Zod
- Generating API documentation with JSDoc/TypeDoc
- Creating architectural decision records (ADRs)
- Debugging complex type errors
- Optimizing type checking performance
Use When
- "Help me do this with strict TypeScript."
- "How should I model this union/generic type?"
- "How do I avoid
anyand unsafe assertions?" - "How do I fix this TypeScript compile error safely?"
Scope
In Scope
- tsconfig and strict-mode guidance.
- Advanced type modeling (generics, conditionals, mapped types).
- Runtime narrowing and type-safe validation patterns.
- TypeScript documentation patterns (JSDoc/TypeDoc, ADRs).
Out of Scope
- End-to-end testing setup.
- Framework build pipeline setup unrelated to TypeScript design.
- Language-agnostic coding standards.
Consolidation Note
This skill consolidates 5 original TypeScript skills (~3,372 lines) into a ~120-line navigation hub with on-demand reference loading:
- typescript-type-system (738 lines) - Compiler config, strict mode, module resolution
- typescript-utility-types (832 lines) - Built-in and custom utility types
- typescript-advanced-types (724 lines) - Generics, conditional types, mapped types, patterns
- typescript-best-practices (270 lines) - Type-first development, illegal states, Zod validation
- typescript-docs (808 lines) - JSDoc, TypeDoc, ADRs, framework-specific documentation
Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| CRITICAL | Compiler & Configuration | Essential foundation | compiler- |
| CRITICAL | Best Practices & Patterns | Type-first workflow | practices- |
| HIGH | Advanced Types | Complex type logic | types-advanced- |
| HIGH | Built-in Utilities | Common transformations | utilities-builtin- |
| MEDIUM | Custom Utilities | Specialized types | utilities-custom- |
| MEDIUM | Type Narrowing | Runtime type guards | narrowing- |
| MEDIUM | Documentation | API docs & ADRs | docs- |
How to Use
Read individual reference files for detailed guidance:
references/compiler-strict-mode.md
references/practices-type-first.md
references/types-advanced-conditional.md
references/utilities-builtin-partial.md
references/docs-jsdoc-patterns.md
Each reference file contains:
- Concepts and explanations
- Practical TypeScript examples
- Common patterns and use cases
- Best practices and pitfalls
- Performance considerations
Navigation Workflow
- Start with practices - Understand type-first development workflow
- Configure compiler - Set up tsconfig with strict mode; run
npx tsc --noEmitto confirm zero errors before proceeding - Apply advanced types - Use generics, conditionals, mapped types; run
npx tsc --noEmitafter each change — if errors persist, consultreferences/types-advanced-conditional.md - Use utilities - Leverage built-in and custom utility types; if assignability errors appear, check
references/utilities-builtin-partial.md - Implement narrowing - Add type guards for runtime safety; run
npx tsc --noEmitto confirm narrowing is recognised — if not, consultreferences/narrowing-guards.md - Document - Generate API docs with JSDoc/TypeDoc; run
npx typedoc --out docs src/index.tsand verify output
Quick Commands
Type Check
npx tsc --noEmit
Type Check Single Entry
npx tsc --noEmit src/index.ts
Generate Docs
npx typedoc --out docs src/index.ts
Find Unsafe Patterns
rg -n "\\bany\\b|@ts-ignore| as " src
Quick Fixes
Common TypeScript errors and their safe resolutions:
"Type X is not assignable to type Y"
Caused by incompatible types being assigned without narrowing.
// BAD — forces an incompatible assignment
const id = getValue() as string;
// GOOD — narrow first, then assign
const raw = getValue();
if (typeof raw !== "string") throw new TypeError("Expected string");
const id = raw; // TypeScript now knows id: string
"Object is possibly 'undefined'"
Caused by accessing a property without a null/undefined check.
// BAD — unsafe access
function getLength(arr: string[] | undefined) {
return arr.length; // error
}
// GOOD — guard before access
function getLength(arr: string[] | undefined): number {
if (arr === undefined) return 0;
return arr.length;
}
"Parameter implicitly has an 'any' type"
Caused by missing type annotations under noImplicitAny.
// BAD — implicit any
function double(n) {
return n * 2;
}
// GOOD — explicit annotation
function double(n: number): number {
return n * 2;
}
Anti-Patterns
NEVER use any as a default escape hatch
WHY: any disables type checking and hides design bugs.
BAD:
function process(data: any) {
return data.value;
}
GOOD:
function process<T extends { value: unknown }>(data: T) {
return data.value;
}
NEVER silence type errors with unchecked assertions
WHY: assertions bypass compiler safety without runtime guarantees.
BAD:
const id = input as string;
GOOD:
if (typeof input !== "string") throw new TypeError("Expected string");
const id = input;
NEVER disable strict-mode findings instead of fixing model issues
WHY: strict mode surfaces real defects early.
BAD: @ts-ignore, strict: false, or broad ignore patterns.
GOOD: adjust type model, narrow correctly, and keep strict checks enabled.
References
What ships with it: 56 files
258.5 KB alongside SKILL.md
evals/
- scenario-01.md3.0 KB
- scenario-02.md3.2 KB
- scenario-03.md2.9 KB
- scenario-04.md3.2 KB
- scenario-05.md3.3 KB
references/
- compiler-module-resolution.md5.4 KB
- compiler-performance.md6.0 KB
- compiler-strict-mode.md6.0 KB
- compiler-tsconfig.md4.7 KB
- docs-adr-templates.md6.9 KB
- docs-framework-docs.md6.6 KB
- docs-jsdoc-patterns.md7.8 KB
- docs-typedoc-config.md6.3 KB
- guards-assertion-functions.md3.3 KB
- guards-basic.md1.8 KB
- guards-branded-types.md6.0 KB
- guards-discriminated-unions.md5.3 KB
- guards-exhaustiveness.md6.3 KB
- guards-generic.md2.6 KB
- guards-inference-infer.md3.3 KB
- guards-inference-return.md3.7 KB
- patterns-advanced-generics.md4.6 KB
- patterns-api-client.md4.4 KB
- patterns-branded-types.md2.4 KB
- patterns-builder.md4.4 KB
- patterns-deep-readonly.md4.3 KB
- patterns-dependency-injection.md5.0 KB
- patterns-event-emitter.md3.5 KB
- patterns-form-validation.md5.8 KB
- patterns-plugin-system.md5.1 KB
- patterns-recursive-types.md2.7 KB
- patterns-state-machine.md6.8 KB
- patterns-type-safe-module.md2.8 KB
- practices-illegal-states.md5.8 KB
- practices-module-patterns.md5.5 KB
- practices-runtime-validation.md4.8 KB
- practices-type-first.md3.1 KB
- types-conditional.md4.8 KB
- AGENTS.md4.3 KB
- CHANGELOG.md374 B
16 more files not listed here. See all 56 in the repository.