prefer-unknown-over-any
CommunityPrefer unknown over any for safer types.
Software Engineering#typescript#type-safety#best-practices#static-analysis#unknown#data-validation#json-parsing
Authorluyi985
Version1.0.0
Installs0
System Documentation
What problem does it solve?
Apply unknown instead of any when values have an unknown type, such as data from JSON, external sources, or untrusted inputs, reducing runtime errors and improving type safety.
Core Features & Use Cases
- Use unknown to force narrowing before use, preventing unsafe operations on values with unknown type.
- Encourage safer APIs by returning unknown until the value is validated.
- Apply in real-world scenarios like JSON parsing, external API responses, and user input handling to ensure safe usage.
Quick Start
Replace any with unknown when you don't know a value's type, then validate before use.
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: prefer-unknown-over-any Download link: https://github.com/luyi985/lyi-bash/archive/main.zip#prefer-unknown-over-any 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.