3 ms·
Came across TypeScript last month, looks interesting. What are the limitations of the type checker? i.e. does the compiler fully have your back, or are we just
by virtualwhys 13y ago
Came across TypeScript last month, looks interesting.
What are the limitations of the type checker? i.e. does the compiler fully have your back, or are we just talking validating whether or not a method param takes a String vs. an Int?
Coffee is a dream [for me], JavaScript, not so much.
- michaelwww 13y agoI'm not sure what you mean by the compiler fully having your back, but it is fairly helpful. It does type inference, which means you don't have to explicitly type everything to get type checking help. You can do as little or as much type checking as you would like. Regular unadorned JavaScript code is TypeScript code and will compile. The compiler will tell you when not all code paths return a value, when the wrong type is passed to a function, when a return value is the wrong type, etc... It keeps track of the symbols in the source making refactoring work as you would expect. I really can't think of any downside since it's just JavaScript.
- virtualwhys 13y agoBy type inference I mean the compiler has your back ;-) If IDE support is getting to the point where you can hover-view/click-through to type, then that is really quite impressive. Will be awhile before that gets to MonoDevelop, however (Linux workstation here). For me the ideal would be a terse syntax a la coffeescript, but with static type checking. I wonder what compile times are like for large-ish TypeScript projects? Imagine it's fairly quick, but even simple static type checking will bring some overhead.
- michaelwww 13y ago> If IDE support is getting to the point where you can hover-view/click-through to type, then that is really quite impressive. Like this? http://i.imgur.com/RRFq0dl.png http://i.imgur.com/RRFq0dl.png Compile times are easily control by breaking the files up. Similar to C# partial class, they can still go in the same module. I'm using the free Visual Studio Express for Web, so I'm not sure about Mono/Linux support, but I hear there is WebStorm and Sublime Text plugin support and one I also like which is Adobe Brackets.
- boromi 13y agoFor all the cases I have checked the type checker is extremely impressive. I have even checked whether types flow through promises! and with underscore.js and it has not failed me yet, it is extremely robust. But aside from that, the most useful feature of typescript to me has been the productivity gains, just checkout: http://www.typescriptlang.org/Playground/ http://www.typescriptlang.org/Playground/ You can now have an IDE that provides useful information about clases/objects/etc. (imagine if javascript actually had proper codecompletion and intellisense)