Where is the TypeScript love?

I am planning a large project. After I reviewed the current technologies and the communities behind it, combining Meteor + React + TypeScript seems like a good way to go.

However it is hard to find some tutorial or samples on this. Also the guide does not seem to mention TypeScript at all.

Did I miss something? Are there any problems with TS?

2 Likes

I know Apollo is being developed in typescript, but you’re right, it would be good to see some guide articles on using it in Meteor. PR anyone?

1 Like

Why don’t use Ecmascript?

2 Likes

You can use ES2015 constructs with typescript (it’s a superset of ES), but you also get the advantage of static typing and linting.

3 Likes

The Angular 2 stuff for Meteor is all in typescript. I believe they use this package: https://github.com/barbatus/typescript

See the details of setup here: https://www.angular-meteor.com/tutorials/socially/angular2/bootstrapping

1 Like

This was discussed a little while back in issue 7467, and a new issue was created to track this in the Guide repo:

PR’s are definitely welcome!

1 Like

There are absolutely no problems in using Typescript. It works like a charm with both React and Meteor. In fact, I’ll get going with that PR to the Meteor guide right away.

@sashko, I would like to make two contributions to the guide, but I’m not sure where they would fit, and maybe you have an opinion on that.

The first is a section that introduce TypeScript and Typings, and how to get them installed in Meteor. I consider making it a section called “TypeScript” or “Static Typing” in the Production chapter.

The second is a typescript version of the Blaze/React sections. To ease maintenance would I ideally like just to add a typescript version of the code snippets throughout the sections instead of duplicating all the text, but I don’t see any functionality for that.

4 Likes

I’ve read there is much better tooling support when you go with Typescript over vanilla JavaScript, can anyone attest to this? I’m using Visual Code from Microsoft, but I use Atom too sometimes. Are there plugins/tooling that take advantage of Typescript for these editors?

VS Code has TypeScript auto-complete and type-checking out of the box, with no plugins or config needed. That’s the #1 reason I picked VS Code and TypeScript for Apollo Client.

2 Likes

Quite a few leading editors support Typescript and the extra intellisense and compile time checking really helps. Here’s a list of various editors. My current favourite is WebStorm, but Atom is on there:

2 Likes

Typescript is pretty good. Having used it to work on Apollo, I grown to really like the type system that understands how people use JavaScript (not just slapping a random type system on). Some of the things I like the most:

  • type guards
  • fast compilation cycles with “watch mode”
  • union types, intersection types, shape-based interfaces
  • superb integration with Emacs through the “tide” package (includes many features, including renaming a symbol)
  • debugging support for VS Code

Things that annoy me in Typescript tooling right now:

  • pulling typings for other packages with “typings” tool is PITA. It feels like “typings” tool is one of those tools that humanity knows how to build well, but JS community is still struggling with
  • some random requirements when exporting a method that returns an unexposed type requires exporting types separately, etc
  • workflow working on multiple inter-connected npm modules written in typescript (but this is like a problem of npm workflow)
8 Likes

I drafted out a chapter for the guide. It can be found here:

Comments are very welcome.

3 Likes

Facebook and all its open source use Flow as type checker.

1 Like

Which make sense because control flow based type analysis first became a feature in TypeScript with the new 2.0 release.

Typescript has had control flow analysis for a while, Flow’s main standout feature is that it’s easy to incrementally adopt in an existing project.

1 Like

Ah, I see. I just remembered a talk where the speaker argued why his team choose to use flow, because of this missing type analysis feature in ts - but it is apparently outdated by now.

1 Like

I feel like that’s the usual destiny of “I chose X and not Y because of feature Z” type decisions.

We have been using Typescript for a couple of months now with angular projects and also with Angular + Meteor.
Only thing I noticed is that the current typescript compiler doesn’t really give feedback about typing errors like with my Gulp angular (yo generator) project.
Maybe it is a config thing.

Thank you @birk.

Your instructions worked like a charm.

There is a typo in “typings”:

typigns install env~meteor --save --global
1 Like

um, so I have to install typings for every single npm package I install?
I use Webstorm. Is there an “auto install” feature".