3 ms·
Typescript is hard. It's module system is a mistake(it should be module system agnostic,not AMD or CommonJS),and very confusing. The biggest problem is javasc
by camus2 13y ago
Typescript is hard.
It's module system is a mistake(it should be module system agnostic,not AMD or CommonJS),and very confusing.
The biggest problem is javascript is so dynamic you cant create type definitions for every library outthere and expect the typesystem to work.
Typescript is good if you are porting something from AS3/C#/Java to javascript,or if You want to model a complex domain,without touching the DOM api(or node api).
It sucks as soon as you try to use jQuery with it.You end up with any everywhere which defeats the purpose of that language.
In my opinion,if you need to pick a js alternative,choose Traceur.
- ehsanu1 13y agoUmm, no experience with typescript here, but can't you use the type annotations from the DefinitelyTyped project [1] to avoid everything becoming `any`? There are open source type annotations for all major (and many minor) libraries, including jquery [2]. [1] https://github.com/borisyankov/DefinitelyTyped https://github.com/borisyankov/DefinitelyTyped [2] https://github.com/borisyankov/DefinitelyTyped/tree/master/jquery https://github.com/borisyankov/DefinitelyTyped/tree/master/j...
- camus2 13y agodefinetly typed doesnt fix everything,just have a look at the ambient declarations.
- pingec 13y agoI could not agree less with your post. I ported a 12k loc JS project to TS and it usese JQuery heaviliy. The result was that the static type system could point out 6 bugs from my original code that unit tests did not find and now I have statement completion and powerful refactoring tools for everything as well. It plays really nice with JQuery if you have the right type declarations and I am more productive now with all the code intellisense I get from the IDE. Also the module system is module system agnostic and it can compile either to commonjs or amd, it depends on a compiler switch. I am using mostly requirejs and it works well.