typescript-strict

Enforce TypeScript strict mode patterns to eliminate unsafe typing.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TypeScript strict mode patterns guide developers to avoid unsafe types and brittle code, reducing runtime errors and making maintenance easier.

Core Features & Use Cases

  • Enforce no any usage and prefer unknown when type is truly unknown, improving type safety.
  • Discourage type assertions (as Type) and non-null assertions, replacing them with proper guards, type narrowing, or defensive checks.
  • Guidance on using type over interface for data structures and promoting immutability with readonly patterns.
  • Ideal for migrating codebases to strict typing, new projects that demand robust type safety, and teams adopting safer coding standards.

Quick Start

Enable strict mode in tsconfig.json, audit code for any/nullable patterns, and refactor sample modules to replace unsafe casts with guards.

Frequently Asked Questions about typescript-strict

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

FAQPage Schema
How do I enforce TypeScript strict mode and eliminate unsafe typing in my project?

To enforce TypeScript strict mode, enable strict settings in tsconfig.json and refactor code to remove any usage, prefer unknown, and replace type assertions with proper type guards for safer code.

What is the best way to replace non-null assertions in TypeScript?

The best way to replace non-null assertions in TypeScript is by applying type narrowing, defensive checks, and proper type guards instead of using the exclamation mark to ensure safe type safety.

How do I refactor a codebase to use readonly data structures and immutable TypeScript patterns?

Refactoring to immutable TypeScript patterns involves applying readonly modifiers to data structures, preferring type over interface for data, and removing unsafe casts to achieve strict immutability.

Can I use strict TypeScript discipline for migrating large applications and improving testability?

Yes, strict TypeScript discipline suits large applications by applying dependency-injection-friendly patterns and eliminating unsafe types, which enhances overall code safety and testability.

When should I prefer unknown over any in TypeScript strict mode?

You should prefer unknown over any in TypeScript strict mode when a variable's type is truly uncertain, forcing you to apply explicit type guards and narrowing before safely accessing properties.

Why does using type assertions break TypeScript strict mode discipline?

Type assertions break TypeScript strict mode discipline because they bypass the compiler's type checking, introducing unsafe casts that can cause runtime errors instead of using proper type guards.