News for hackers. Stuff that matters.
Re:Why Angular 2 Switched to TypeScript by iLoch on Saturday July 23, 2016 @10:10PM (#12151892)
I wanted to use TypeScript with a new React project, but the biggest problem I had (which eventually lead me away from using it) was that typings were so hard to get ahold of. Built something in JS? Sorry, you have to provide what is essentially a source map in order to get it to work with TypeScript. That should be a non-starter for anyone who is doing more than a hello world app. Figure out a way for me to use TS without having to create a bunch of extra type garbage in my app and I'll upgrade my code base immediately.
Re:Why Angular 2 Switched to TypeScript by kfinley on Saturday July 23, 2016 @10:20PM (#12151918)
TypeScript 2 adds Easier Module Declarations[0]. So if a library doesn't have a type definition, you can silence errors by adding:

    declare module "some-module"
Does that help?

0: https://blogs.msdn.microsoft.com/typescript/2016/07/11/annou...

Re:Why Angular 2 Switched to TypeScript by iLoch on Saturday July 23, 2016 @10:32PM (#12151944)
Yes that does actually. My experience may have been with an earlier version of TypeScript. I haven't looked at it in a few months.
Re:Why Angular 2 Switched to TypeScript by k_bx on Sunday July 24, 2016 @06:19AM (#12152908)
TypeScript 2 milestone on github shows it's pretty far from a release (imho). I liked Facebook's Flow language more, but it seems to be less popular.
Re:Why Angular 2 Switched to TypeScript by ctolkien on Sunday July 24, 2016 @09:16AM (#12153215)
V2 is currently in beta.

> In the coming weeks, a more stable release candidate will be coming out, with the final product landing not too far after.

-- https://blogs.msdn.microsoft.com/typescript/2016/07/11/annou...

Re:Why Angular 2 Switched to TypeScript by k_bx on Tuesday July 26, 2016 @10:53AM (#12166020)
Github says "40% complete" in a milestone, that's where I got the impression from https://i.imgur.com/DQoyGeW.png .
Re:Why Angular 2 Switched to TypeScript by k__ on Sunday July 24, 2016 @10:35AM (#12153418)
really?

I have the complete opposite feeling, when looking into the TS2 repo.

Re:Why Angular 2 Switched to TypeScript by k_bx on Tuesday July 26, 2016 @10:54AM (#12166028)
My feeling comes from "40% complete" on a milestone, where did you look at? https://i.imgur.com/DQoyGeW.png
Re:Why Angular 2 Switched to TypeScript by Doolwind on Saturday July 23, 2016 @10:21PM (#12151923)
Most popular projects have typescript bindings. Check out https://github.com/DefinitelyTyped/DefinitelyTyped for a big list.

If you're using a library and can't find bindings then I've found it's worth the time creating them yourself for any reasonably sized project. This is annoying and time consuming up front, but the benefits you get down-stream easily repay this initial investment.

Re:Why Angular 2 Switched to TypeScript by ng12 on Sunday July 24, 2016 @12:45AM (#12152253)
To me, this was the silliest thing about working on a large typescript project. It slowed build times, we had issues with GitHub throttling, and the typings were commonly incorrect or incomplete.
Re:Why Angular 2 Switched to TypeScript by mamp on Saturday July 23, 2016 @10:24PM (#12151930)
Same happened with me. I then moved to flow-type (hint, install it via 'sudo npm install -g flow-bin'), and linter-flow for atom. It's a bit temperamental but the type inference means you don't have to be quite as explicit throughout all of your code. Already saved me a lot of frustration and time.

Although TypeScript 2 is catching up, the fact that flow works with babel to support many ES6/ES7 features e.g. object spread.

Coming most recently from F# I would have gone insane without some kind of static typing extension in Javascript.

Re:Why Angular 2 Switched to TypeScript by iLoch on Saturday July 23, 2016 @10:36PM (#12151953)
We use C#, and are hoping to move to .NET Core with future projects. I use Visual Studio Code exclusively, so TypeScript seemed like the obvious choice (I'm primarily a JS developer so I'm well aware of flow, however the support for TS in VS Code as a general solution to types in JS is unparalleled in my opinion). Not to mention Atom was ungodly slow on my high end MBP so I laughed and deleted it.
Re:Why Angular 2 Switched to TypeScript by jiaweihli on Sunday July 24, 2016 @12:12AM (#12152182)
You aren't required to use import, use require if you don't care for typings:

`var aLibrary: any = require('aLibrary');`

Re:Why Angular 2 Switched to TypeScript by cheez on Saturday July 23, 2016 @10:12PM (#12151896)
I was under the impression that typescript is a superset of javascript. Is that not the case?
Re:Why Angular 2 Switched to TypeScript by dweinus on Saturday July 23, 2016 @11:00PM (#12152024)
The title of one of the article sections is literally "TypeScript is a Superset of JavaScript" ...people do still read before commenting, right?
Re:Why Angular 2 Switched to TypeScript by cheez on Saturday July 23, 2016 @11:08PM (#12152052)
Just wondering why you can't use React directly if that is the case
Re:Why Angular 2 Switched to TypeScript by iLoch on Saturday July 23, 2016 @11:17PM (#12152079)
In order for TypeScript to understand the types it is interfacing with (especially in the case of libraries) there has to be a type definition created for each library. Dismissing my complaint because "TypeScript is a superset of JavaScript" shows a lack of understanding regarding how the system works.
Re:Why Angular 2 Switched to TypeScript by rplst8 on Saturday July 23, 2016 @10:15PM (#12151904)
It is. I've not written anything in it other than a few simple tutorials, so I'm not an expert, but from what I've read you can drop to straight JS in your TS source code.
Re:Why Angular 2 Switched to TypeScript by abritinthebay on Saturday July 23, 2016 @11:25PM (#12152096)
It is, but that means less than most TS advocates realize.

I mean Objective-C is something like 97% a superset of C... doesn't make the transition any easier.

Re:Why Angular 2 Switched to TypeScript by smt88 on Monday July 25, 2016 @07:52AM (#12158001)
There is a huge difference between 97% superset and 100% superset. JS is valid TS without changing anything. The transition is easy.
Re:Why Angular 2 Switched to TypeScript by abritinthebay on Monday July 25, 2016 @09:09PM (#12162705)
Actually there is only a 3% difference. Which isn't actually that huge (most not hugely complex C programs are valid Objective-C programs, at least with a couple of minor tweaks).

As I said - it's a silly marketing point that isn't convincing anyone already not convinced by TypeScript and they'd do better to drop it as a talking point.