Search code examples
angulartypescriptfile-type

Why does Angular 2 use the .ts file extension?


Why is the .ts file extension used in Angular 2?


Solution

  • The .ts extension is used by TypeScript. Angular 2 does not really use the .ts extension. The code produced by the TypeScript compiler will be JavaScript with the .js extension. You can also use Dart as a development language that will still produce JavaScript code. If you feel like avoiding TypeScript or Dart, you can use plain JavaScript for developing Angular 2 applications.

    With TypeScript you get some options that are not available to you in plain JavaScript. The definition of TypeScript from its web site is:

    TypeScript is a typed superset of JavaScript that compiles to plain JavaScript

    To lean more about TypeScript visit its web site.