News for hackers. Stuff that matters.
Re:JavaScript libraries should be written in TypeScript by rtpg on Wednesday March 16, 2016 @09:44AM (#11297186)
I can absolutely understand that coming from coffeescript (optional parentheses resolution... yikes).

But TypeScript is basically "Javascript + types + ES6". They call it an "erasing compiler" because it's not meant to do much but remove types/make ES6 code work with ES5.

There is one gotcha in name resolution when you're working in modules (if you are in a module a.b, and a.c exists, then c will automatically refer to a.c, even if a global c exists). But that usually gets caught by the type system. Lot less issues than coffeescript IMO

Re:JavaScript libraries should be written in TypeScript by wereHamster on Wednesday March 16, 2016 @10:12AM (#11297420)
With `--target=es6` I'm not sure if the TypeScript compiler does any code transformation other than removing type annotations. So the chance of a 'transpiler error' is basically zero.
Re:JavaScript libraries should be written in TypeScript by bd82 on Wednesday March 16, 2016 @11:01AM (#11297838)
There are a few small things that still require conversion. But that is because Typescript also includes capabilities from ES7 (ES2016).

For example - currently in Typescript but only planned for ES7: https://github.com/jeffmo/es-class-fields-and-static-propert...

or Support ES7: exponentiation operator https://github.com/Microsoft/TypeScript/issues/4812

Typescript seems to be more like ECMAScript.next + types rather than ES6 + types.

Re:JavaScript libraries should be written in TypeScript by ascetone on Wednesday March 16, 2016 @11:06AM (#11297885)
My favourite thing they brought over from ES7 is async/await support via ES6 generators.
Re:JavaScript libraries should be written in TypeScript by joshuacc on Wednesday March 16, 2016 @12:08PM (#11298380)
FYI, those are not ES2016 features. ES2016 only includes two small feature enhancements. They might make it into 2017, but if TC39 decides they're not ready, they'll just keep not including the feature in the annual spec revision.
Re:JavaScript libraries should be written in TypeScript by emodendroket on Wednesday March 16, 2016 @10:27AM (#11297547)
Well the classes are converted into functions and it adds members to the prototypes, right? Or is that ES5 only?
Re:JavaScript libraries should be written in TypeScript by boredpudding on Wednesday March 16, 2016 @10:30AM (#11297580)
What you mean is indeed ES5 only. ES6 has classes so it doesn't need to convert anything.
Re:JavaScript libraries should be written in TypeScript by emodendroket on Wednesday March 16, 2016 @10:38AM (#11297650)
Oh. Cool. I didn't know that.