Questions like these are popping up all over the place:
“If I only want to learn one, should it be TypeScript or ES6?”
“Which language will I need to use for Angular 2?”
“Can I use any existing libraries with TypeScript?”
This isn’t actually the case with either TypeScript or ES6, though. Let’s go over some common questions.
Here’s a table of contents if you want to skip around:
Officially, ES6 is now called ES2015. You’ll probably see both used interchangably around the web for the foreseeable future. The state of things in October 2015, as far as I can see, is that most people are still calling it “ES6,” so I’ll do that here.
And just for completeness, “ES7” is the same as “ES2016.” Maybe by next year we can all agree on what to call it…
Yes. Take a look at the Angular 2 Github repo and you’ll see a bunch of files with a
.ts extension. The Angular 2 team is writing in TypeScript.
No. According to the angular2 npm package description, they’re packaging the framework 3 different ways:
- Files in the root folder can be used with CommonJS.
- Files under
/es6can be transpiled to ES5.
- Files under
/tsare the TypeScript source.
- (bonus) They provide a
es5build.jsscript to transpile ES6 to ES5 live in the browser.
- (bonus2) They provide a
sfxversion (“Self-Executing bundle”) that includes SystemJS and any required transpiler. If you went through the Angular 2 in Plain JS tutorial, that’s how that worked.
No! Just because the framework is written in TypeScript, this does not mean that you have to write your app in TypeScript. It’s perfectly possible to write Angular 2 in ES6 (or even ES5).
Technically, yes. Check out my post about writing a “hello world” in Angular 2 with ES5. This is probably not the most future-proof strategy though – I think you’ll want to ultimately learn and use ES6 to write real Angular 2 apps.
I’d recommend trying to write a little bit of code with each, and deciding for yourself.
A lot of people have very strong opinions for or against TypeScript. It’s still a very much optional language built on top of ES6.
The Venn diagram looks something like this:
- ES6 adds some nice constructs to ES5 (lambda/arrow functions,
letvariables with more logical scoping rules,
- TypeScript adds types (and a couple other things) to ES6
- The added type information means IDEs can be smarter, and maybe the compiler will catch some errors.
No, you don’t have to use Visual Studio (Code, or otherwise).
- There’s a plugin for Atom
- There’s a plugin for Sublime
- WebStorm 11 has a release candidate ready for download that supports TypeScript 1.5 and 1.6
- And of course Visual Studio Code (Microsoft’s lightweight Sublime-style IDE) has support
Yes, it’s written and supported by Microsoft. They created the Sublime plugin, too. I will just leave the rest of that alone :)
Leave a comment below, or email me and I or someone else in the community will try to answer.
Learning React can be a struggle — so many libraries and tools!
My advice? Ignore all of them :)
For a step-by-step approach, check out my Pure React workshop.
Learn to think in React
- 90+ screencast lessons
- Full transcripts and closed captions
- All the code from the lessons
- Developer interviews
Dave Ceddia’s Pure React is a work of enormous clarity and depth. Hats off. I'm a React trainer in London and would thoroughly recommend this to all front end devs wanting to upskill or consolidate.