context-type-inference
CommunityPreserve type context when extracting values.
Software Engineering#typescript#type-inference#context-preservation#satisfies#const-assertions#tuples#callback-types
Authorluyi985
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This guide explains how separating a value from its usage context can cause TypeScript to widen the inferred type, leading to runtime surprises and type errors, and how to preserve the precise context.
Core Features & Use Cases
- Restores context using type annotations, const declarations, as const, or satisfies.
- Helps in scenarios with extracted callbacks, tuple literals, and string literals that widen to general types.
- Provides practical guidance for maintaining accurate types during extraction in complex codebases.
Quick Start
Use a const declaration or explicit type to preserve context when extracting a value.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: context-type-inference Download link: https://github.com/luyi985/lyi-bash/archive/main.zip#context-type-inference Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.