Dennis Nerush
Dennis Nerush

Reputation: 5663

TypeScript in MVC

Im bulding a website using MVC4. Recently I've read about TypeScript. It looks really nice however I cannot find any use for it in a MVC website. Am I missing something? Do you use it? Where?

Upvotes: 1

Views: 559

Answers (3)

Nikos
Nikos

Reputation: 7552

You can link to the generated javascript files from TS files directly in the script bundles or HTML. If you want to automatically link to many JS files, use require JS. This will save you having to link to many js files.

Upvotes: 0

Golo Roden
Golo Roden

Reputation: 150614

TypeScript is a pre-compiler for JavaScript. Hence you can use TypeScript only as a replacement for JavaScript (server-side, e.g. Node.js, or client-side, i.e. in the browser).

As you are probably writing MVC4 code with C#, TypeScript will be of no use for you in relation to MVC4.

Regarding the client-side it's somewhat different.

I guess the main point you need to know is that TypeScript is not (yet) just another language on the server, that you can exchange with C#.

Upvotes: 3

Tetaxa
Tetaxa

Reputation: 4393

I find it quite useful for building largish apps with lots of logic on the client. The interfaces help avoid some errors. It compiles to javascript so you could use it instead of javascript. If you're just writing a couple of lines I wouldn't bother though.

Upvotes: 0

Related Questions