6

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.

3
  • 5
    TS "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! Commented Jul 5, 2016 at 14:10
  • Yup we use Typescript with AngularJS and its no problem 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.com/bp3foi Commented Jul 5, 2016 at 14:19

5 Answers 5

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.

Sign up to request clarification or add additional context in comments.

3 Comments

Excellent. I may be in a similar situation. So does TS somehow make the migration easier?
Migrating a 1.x angular app into angular 2 isn't that simple and depends on how you coded your application. Your last concern would be if your 1.x app is written in Typescript or not.
Which is very true. Typescript doesn't mean its Angular 2 compatible, since plain javascript can be written in typescript. It all depends on how the code is written for a project.
3

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

Comments

1

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

0

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.

P.s. Angular2 was built on Typescript.

Comments

-1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.