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.
-
5TS "compiles" 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– Jite2016-07-05 14:10:50 +00:00Commented Jul 5, 2016 at 14:10
-
Yup we use Typescript with AngularJS and its no problemRevive– Revive2016-07-05 14:12:20 +00:00Commented 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.com/bp3foibriosheje– briosheje2016-07-05 14:19:13 +00:00Commented Jul 5, 2016 at 14:19
5 Answers
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.
3 Comments
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
Comments
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.
Comments
Angular 2 is available with TypeScript . Have a look here for Angular 2 Quickstart in Typescript https://angular.io/guide/quickstart