typescript-strict

Guide TypeScript strict mode coding for Lea codebase AST node types and declarations.

4|Updated Dec 8, 2025
One-click install
npx skills add https://github.com/mcclowes/lea --skill typescript-strict-mcclowes
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-strict
Source: https://github.com/mcclowes/lea/tree/main/.claude/skills/typescript-strict
Command: npx skills add https://github.com/mcclowes/lea --skill typescript-strict-mcclowes

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Enforces strict TypeScript practices for Lea-related codebases, including discriminated unions, generics, and declarations.

Core Features & Use Cases

  • Strict nulls & guards: Null safety and type guards
  • Discriminated unions: Robust AST typing
  • Generics & declarations: Reusable, well-typed code

Quick Start

Add tsconfig strict options and start building typed ASTs.

Frequently Asked Questions about typescript-strict

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable TypeScript strict mode for type safety in my project?

Enable strict mode in your tsconfig.json to activate strict null checks, no implicit any, and other type-safety rules. This enforces compile-time checking for null values, requires explicit type annotations, and prevents unsafe type coercion, catching errors before runtime.

What are discriminated unions and why use them for AST typing?

Discriminated unions use a literal type field to distinguish between union members, enabling precise type narrowing. For AST nodes, they ensure the correct properties exist on each node type, eliminating unsafe property access and making type guards predictable.

How do I write type-safe generics with strict constraints?

Define generic constraints using the `extends` keyword to limit what types can be passed. Strict mode requires explicit type parameters and catches mismatches at compile time, ensuring reusable code maintains type safety across different input types.

What's the difference between type guards and null checks in strict mode?

Type guards narrow types within code blocks using predicates or typeof checks, while null checks verify non-null values. Strict mode requires both: null checks prevent accessing properties on potentially null values, and type guards refine unions to access type-specific properties safely.

Can I generate .d.ts declaration files with strict type inference?

Yes, TypeScript generates declaration files automatically when configured. Strict mode ensures inferred types are explicit and accurate, making declaration files reliable for consumers and preventing implicit any leaks in public APIs.

Do I need to refactor existing code to adopt strict mode?

Enabling strict mode on existing code typically requires fixes: adding null checks, explicit type annotations, and type guards. Gradual adoption is possible per-file, but strict mode catches real bugs and prevents entire categories of runtime errors.