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.
Overall
score
99%
Does it follow best practices?
Validation for skill structure
{
"compilerOptions": {
// Type Checking
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"strictBindCallApply": true,
"strictPropertyInitialization": true,
"noImplicitThis": true,
"alwaysStrict": true,
// Additional Checks
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
// Module Resolution
"moduleResolution": "bundler",
"module": "ESNext",
"target": "ES2022",
"lib": ["ES2022"],
// Emit
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
// Interop Constraints
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"isolatedModules": true,
"verbatimModuleSyntax": true,
// Language and Environment
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
// Projects
"composite": true,
"incremental": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}strict - Enable all strict type checking options
noImplicitAny - Error on expressions and declarations with implied any
any usagestrictNullChecks - null and undefined require explicit handling
noUncheckedIndexedAccess - Index signatures return T | undefined
const config: Record<string, string> = {};
const value = config['key']; // string | undefined (not just string)exactOptionalPropertyTypes - Distinguish between undefined and missing properties
interface User {
name?: string;
}
const user1: User = { name: undefined }; // Error with exactOptionalPropertyTypes
const user2: User = {}; // OKmoduleResolution - Strategy for resolving module imports
"node16" / "nodenext" - For Node.js ESM/CJS hybrid projects"bundler" - For bundlers (Vite, esbuild, Webpack)module - Output module system
"ESNext" - Modern ESM"CommonJS" - Node.js CJS"NodeNext" - Node.js with package.json "type": "module"baseUrl and paths - Path mapping
{
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@/*": ["./*"],
"@components/*": ["./components/*"]
}
}
}declaration - Generate .d.ts files
declarationMap - Generate source maps for .d.ts files
sourceMap - Generate .js.map files for debugging
outDir - Output directory for compiled files
rootDir - Root directory of source files (for maintaining structure)
isolatedModules - Ensure each file can be safely transpiled independently
type keywordesModuleInterop - Enable CommonJS/ESM interop
import React from "react" instead of import * as ReactverbatimModuleSyntax - Require import type for type-only imports
isolatedModulesFor monorepos and large projects:
{
"compilerOptions": {
"composite": true,
"declaration": true,
"declarationMap": true,
"incremental": true
},
"references": [
{ "path": "../shared" },
{ "path": "../utils" }
]
}Benefits:
"strict": truetarget and lib appropriatelyInstall with Tessl CLI
npx tessl i pantheon-ai/typescript-advancedreferences