admin管理员组

文章数量:1300225

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.

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.

Share Improve this question asked Jul 5, 2016 at 14:09 MadPhysicistMadPhysicist 5,84113 gold badges49 silver badges121 bronze badges 3
  • 5 TS "piles" to JavaScript. So you can pretty much use TS anywhere you can use JS. As a matter of fact, you could even mix, and have an app written in both TS and JS, and even write JS in TS files! – Jite Commented Jul 5, 2016 at 14:10
  • Yup we use Typescript with AngularJS and its no problem – Revive Commented Jul 5, 2016 at 14:12
  • Hey, just a side note: in the typescript website there actually is a snippet in the bottom of the page where angular developers references to typescript itself for being useful to them: prntscr./bp3foi – briosheje Commented Jul 5, 2016 at 14:19
Add a ment  | 

5 Answers 5

Reset to default 3

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.

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

Typescript is a transpiler that piles 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.

P.s. Angular2 was built on Typescript.

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

本文标签: javascriptIs It Possible to Use Typescript in an AngularJS ApplicationStack Overflow