Vinod Srivastav
Vinod Srivastav

Reputation: 4255

What the purpose of Typescript?

"TypeScript lets you write JavaScript the way you really want to. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open Source."

According to it,

I was looking for these answers but the most of the basic thread related to TypeScript are closed.

Upvotes: 1

Views: 529

Answers (2)

Dick van den Brink
Dick van den Brink

Reputation: 14499

Agree with @JLRishe from above but I wanted to point out a very important (at least for me) benefit from TypeScript.

With the Type annotations (eg: foo: string; bar: number and :ClassName) I can safely change something with refactor->rename knowing that TypeScript will change everything where it is used. So because of the annotations the tooling knows where you use objects and can help you with "go to definition", "find all references", "refactor->rename" making big changes in very large projects a lot easier and less dangerous.

Also language features like classes, modules, generics make it easier to create large apps!

Upvotes: 0

JLRishe
JLRishe

Reputation: 101662

Typescript is create just to ease the javaScript development. Am i right ?

Yes, Typescript offers several syntactical features that are either (1) not present in JavaScript, or (2) part of a future JavaScript proposal and not supported by most browsers.

CoffeeScript exists for a similar reason, except that its syntax is quite different from JavaScript and it does not attempt to be a superset of JavaScript.

or it has something more to offer ?

What else would you have in mind?

can in use in html pages ? is it compatible with all the modern browsers ?

It is possible to compile and run TypeScript within a web page, though the browser will not do this for you automatically. typescript-compile provides the ability to do this, but there are big performance drawbacks to doing so.

Typically, one would compile TypeScript into JavaScript ahead of time and include the compiled JavaScript in a page. You can set up a build process to do this, and ASP.NET projects have built-in functionality to do Typescript -> JavaScript compilation without any manual steps.

Upvotes: 5

Related Questions