简体   繁体   中英

Is It Possible to Use Typescript in an AngularJS Application?

I am curious when it would be appropriate or prudent to use Typescript in an AngularJS application? I have seen tutorials where TS is used in a Node, Express, Mongo back-end. However, I am curious how TS holds up when Angular is added into consideration.

Yes, it is definitely all right to use. I work on a project with angular 1.4 and Typescript. It was done that way keeping in mind future migration to Angular 2.

Angular 2 is available with TypeScript . Have a look here for Angular 2 Quickstart in Typescript https://angular.io/guide/quickstart

Typescript is a transpiler that compiles it's code into JavaScript.

Since angularjs is a JavaScript framework, it works naturally.

There are definitely typed files that were made for angular as you can see here .

Ps Angular2 was built on Typescript .

Yes you can. You will have to install the typings for Angular. You can do this with the TypeScript Definition Manager. Basically what this does is tell typescript how Angular is (strict) typed.

Using NPM:

npm install -g tsd
tsd install angular

TypeScript can be used with Angular or any similar framework. All you need is definitely typed version of framework. AngularJS typings and code samples can be found here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM