What problem does it solve?
This Skill combats the pervasive issue of loose TypeScript usage, particularly the any type, which undermines type safety, leads to runtime errors, and makes codebases difficult to maintain.
Core Features & Use Cases
- Zero Tolerance for
any: Strictly enforces the avoidance of any, guiding users to use unknown with type guards for truly dynamic scenarios.
- Explicit Typing: Requires explicit function parameters and return types, proper interfaces for all data structures, and specific types over broad ones.
- Strict Configuration: Provides a
tsconfig.json configuration to enable strict mode, catching potential type errors at compile time.
- Use Case: When reviewing a pull request, activate this skill to automatically identify and flag any
any types, missing return types, or improperly defined interfaces, ensuring high-quality, type-safe TypeScript code.
Quick Start
Example: Explicitly typed function with interface
interface User {
id: string;
name: string;
email: string;
}
function createUser(data: User): User {
return {
id: data.id,
name: data.name,
email: data.email,
createdAt: new Date()
};
}
Example: Using 'unknown' with a type guard
function isUser(data: unknown): data is User {
return (
typeof data === 'object' &&
data !== null &&
'id' in data &&
'name' in data
);
}