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

Was this helpful?