typescript-strict

Configure tsconfig.json with TypeScript strict flags and branded types.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/jrmatherly/metorial-workspace --skill typescript-strict-jrmatherly
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-strict
Source: https://github.com/jrmatherly/metorial-workspace/tree/main/.github/skills/typescript-strict
Command: npx skills add https://github.com/jrmatherly/metorial-workspace --skill typescript-strict-jrmatherly

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you adopt and enforce TypeScript's strict mode to catch type errors during compilation, preventing runtime bugs and ensuring safer, more maintainable code.

Core Features & Use Cases

  • Strict mode enablement: Configures the TypeScript compiler to enforce comprehensive type checks.
  • Index safety & exhaustiveness: Encourages noUncheckedIndexedAccess and exhaustive switch patterns to avoid undefined and unhandled cases.
  • Branded types & runtime safety: Introduces branded types and type-safe IDs to prevent ID mixups in domain logic.
  • Path aliases & project structure: Demonstrates how to structure tsconfig.json paths for scalable codebases.

Quick Start

Apply strict mode to a TypeScript project by updating tsconfig.json (enabling strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes, etc.) and implementing branded types for IDs.

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 in an existing project?

Enable TypeScript strict mode by updating your tsconfig.json file to activate strict flags like strict, noUncheckedIndexedAccess, and exactOptionalPropertyTypes. This configures the TypeScript compiler to enforce comprehensive type checks, catching potential runtime bugs during compilation.

What are branded types in TypeScript and when should I use them?

Branded types in TypeScript are specialized types used to prevent ID mixups in domain logic. You should use branded types when you need type-safe IDs to distinguish between different entities, ensuring that an incorrect ID type is caught at compile time.

How does noUncheckedIndexedAccess prevent undefined errors in TypeScript?

The noUncheckedIndexedAccess flag prevents undefined errors by forcing the TypeScript compiler to treat array and object index accesses as potentially undefined. This strict mode configuration ensures you explicitly handle undefined cases, avoiding runtime errors from unhandled elements.

Can I use exhaustive switch patterns with TypeScript strict mode?

Yes, you can use exhaustive switch patterns with TypeScript strict mode to ensure all possible cases are handled. This approach works alongside strict flags to prevent unhandled cases, making your code safer by catching missing logic during compilation.

What is the best way to configure path aliases in tsconfig.json for a scalable codebase?

Configure path aliases in tsconfig.json by defining the paths property to map import locations to specific directories. This structures your project for scalable codebases by simplifying imports and ensuring strict type checking applies across the defined project structure.