关于 .ts

TypeScript menambahkan: static type annotations (let x: number = 5), interfaces, enums, generics, utility types (Partial, Required, Pick, Omit), type guards, dan discriminated unions. Semua kode JavaScript valid adalah TypeScript. TypeScript compiler (tsc) menghapus type annotations dan menghasilkan JavaScript. Keunggulan: deteksi error saat compile time (bukan runtime), autocompletion lebih baik di IDE, refactor lebih aman, dan dokumentasi built-in melalui types. Digunakan oleh: Angular (bahasa default), Next.js, NestJS, Deno, dan banyak framework modern. TypeScript sangat populer di enterprise dan proyek besar. tsconfig.json mengatur konfigurasi compiler. Ekosistem DefinitelyTyped menyediakan type definitions untuk ribuan library. Kekurangan: waktu compilation, learning curve untuk type system, dan boilerplate untuk type definitions.

支持的软件

  • Visual Studio Code 免费
  • TypeScript Compiler 免费
  • WebStorm 付费

替代格式

.js .jsx .tsx .mjs