TypeScript

Guida di stile TypeScript completa per progetti PANDEV, estende le convenzioni JavaScript con type safety e best practices.

🎯 Overview

TypeScript aggiunge type safety ai progetti JavaScript PANDEV. Questa guida copre:

  • Type System: Types, interfaces, generics

  • Framework Support: React, Vue, Angular, Node.js

  • Tools: TSC, ESLint, Prettier

  • Best Practices: Type safety, performance, maintainability

📋 Standard Adottati

Configurazione Base TypeScript

Utilizziamo strict mode per massima type safety:

// tsconfig.json
{
  "compilerOptions": {
    "strict": true,
    "target": "ES2022",
    "module": "ESNext",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  }
}

ESLint TypeScript

Estende la configurazione JavaScript con regole TypeScript:

🛠️ Setup Rapido

1. Installazione Dependencies

2. File tsconfig.json PANDEV

3. Scripts Package.json

🎨 Framework-Specific Configurations

React + TypeScript

Vue + TypeScript

Angular + TypeScript

Node.js + TypeScript

📝 Type System Best Practices

1. Type Definitions

2. Utility Types

3. Type Guards

🎯 Naming Conventions

TypeScript Specific

🔧 Configuration Files

ESLint + TypeScript

Prettier TypeScript

🚀 Performance & Best Practices

Compilation Performance

Type-only Imports

Strict Configurations

📚 Risorse

Documentazione Ufficiale

Framework Integration

Per configurazioni dettagliate e regole specifiche, consulta le sezioni dedicate:

Last updated