noimplicitany-completion

📁 marius-townhouse/effective-typescript-skills 📅 10 days ago
1
总安装量
1
周安装量
#54095
全站排名
安装命令
npx skills add https://github.com/marius-townhouse/effective-typescript-skills --skill noimplicitany-completion

Agent 安装分布

mcpjam 1
openhands 1
replit 1
windsurf 1
zencoder 1

Skill 文档

Don’t Consider Migration Complete Until You Enable noImplicitAny

Overview

noImplicitAny is the cornerstone of TypeScript’s type safety. When disabled, TypeScript silently gives variables the any type when it can’t infer a type. This defeats the purpose of TypeScript. Don’t consider your migration complete until you’ve enabled noImplicitAny and eliminated all implicit anys.

When to Use This Skill

  • Finishing TypeScript migration
  • Enabling strict mode
  • Finalizing tsconfig configuration
  • Ensuring type safety
  • Completing TypeScript adoption

The Iron Rule

Enable noImplicitAny to complete your TypeScript migration. Eliminate all implicit anys for full type safety.

Example

// With noImplicitAny: false (default during migration)
function parse(data) {
  // data is implicitly any - no error!
  return data.json();
}

// With noImplicitAny: true
function parse(data) {
  // Error: Parameter 'data' implicitly has an 'any' type
  return data.json();
}

// Fixed with explicit type
function parse(data: string): unknown {
  return JSON.parse(data);
}

Enabling Strict Mode

{
  "compilerOptions": {
    "noImplicitAny": true,
    "strictNullChecks": true,
    "strictFunctionTypes": true,
    "strictBindCallApply": true,
    "strictPropertyInitialization": true,
    "noImplicitThis": true,
    "alwaysStrict": true
  }
}

Reference

  • Effective TypeScript, 2nd Edition by Dan Vanderkam
  • Item 83: Don’t Consider Migration Complete Until You Enable noImplicitAny