7 ms·
I think Typescript solves a lot of these problems. The type system is amazing, conversions are explicit. Syntax is slightly improved, built-in class system. Th
by embwbam 13y ago
I think Typescript solves a lot of these problems. The type system is amazing, conversions are explicit. Syntax is slightly improved, built-in class system.
The others I don't really mind: I like writing event-loop code over threads, and have never once run into Object.prototype problems in the wild.
- dasil003 13y agoI hadn't heard of Typescript, but I think we'll be seeing a lot more efforts along these lines. Despite the pain and inelegance of compiling something to Javascript, I see two inexorable forces that will lead a lot of smart engineers in that direction. First, running the same UI code on the front-end and back-end will enable the best performing apps across platforms. Imagine being able to run a rich client on a powerful PC that just talks to an API and does all the rendering as a single page app, while simultaneously being able to serve up pure HTML/CSS to mobile devices and search engines. Being able to run code on the server or client as needed solves too many problems to ignore. But on the other hand, javascript flexibility and lack of type system will inevitably cause problems as the codebase grows unless you have a good lead developer to define standards and an iron-fisted approach to code reviews. Personally I think coding standards are a stretch with a language as wild as javascript, and a higher level language to enforce certain things is the best way to reconcile these two problems. I can even imagine supplementing with something like (for instance) a Haskell library that lets you generate JS code for interfacing with the back-end in a provably correct fashion, and plugging that into the UI code.
- k3n 13y agoWhere have you been hiding? There's been a virtual explosion in the number of languages that compile down to JS[1] in just the past 1-2 years, and TypeScript is probably the youngest of them all. CoffeeScript[2] is another big one, I believe it's much more Ruby-like. There's even 7 projects involving Haskell. 1. http://altjs.org/ http://altjs.org/ 2. http://coffeescript.org/ http://coffeescript.org/
- dasil003 13y agoWell I'm a Ruby guy so I'm definitely aware of Coffeescript, but mostly I'm just not starting a lot of greenfield projects these days :(
- Kiro 13y agoWhat's so good about TypeScript's type system and what problem does it solve?
- 10098 13y agoProblems like I look at a function and have no clue about what it's arguments are.
- tracker1 13y agoJSDoc comments?
- 727374 13y agoIn general, I believe it will help make larger JS codebases more maintainable. Specifically it enhances the following: - Refactoring e.g. easily globally change a class member's name - Type safety e.g. it will bark if you pass a string where an int is expected - General IDE handyness e.g. 'Go to definition' A really good demo here: http://channel9.msdn.com/Events/Build/2013/3-314 http://channel9.msdn.com/Events/Build/2013/3-314
- zcrar70 13y agothe two best features of Typescript's type system IMHO are: - structural typing for interfaces (which means that classes implicitly implement an interface if the definitions match) - gradual typing (mainly the ability to convert between 'any' and other types implicitly, which makes it much easier to interact with JS libraries/port JS code to Typescript.) More generally speaking, Typescript aims to solve the problem of maintaining large codebases by giving you the additional security of static typing. The idea is that many simple errors can often be caught by a compiler, but would be much more time-consuming to find otherwise.
- tracker1 13y agoJS already has this.. if (obj && obj.quack && typeof obj.quack == 'function') obj.quack(); //looks like a duck
- 13y ago
- yareally 13y agoI've been using TypeScript for experimenting with Node.js and while it's a great solution there's a few difficulties some might face with it: -TypeScript definitions for many libraries, such as express are out of date and require modding to use. -Visual Studio has no built in support for TypeScript with Node for debugging, but it has been mentioned as likely to be added by the TypeScript team eventually. -There are third party plugins for Node in Visual Studio for debugging, but none support TypeScript yet. I've found the best solution thus far is Intellij IDEA or WebStorm, as it has support for both Node and TypeScript.
- novaleaf 13y agofyi, webstorm 7 has good compiler support for typescript, but the ide intellisence/ syntax highlighting is still not great. i use typescript professionally, i use vs2013 for writing code, webstorm for debugging / testing