3 ms·
I recently had to do some Node.js scripting. My JavaScript experience was minimal and having worked almost exclusively with typed languages I considered Typescr
by maxxxxx 9y ago
I recently had to do some Node.js scripting. My JavaScript experience was minimal and having worked almost exclusively with typed languages I considered Typescript. I decided against it eventually because I figured you need to know JavaScript first to understand the JavaScript ecosystem even if you are writing your own code in TypeScript.
Does this make sense or is it feasible to skip learning JavaScript and jump directly to TypeScript?
- _ar7 9y agoShort answer is yes. TypeScript to JS is kinda like C++ to C. You can learn one before the other and a lot of the skills are transferable.
- maxxxxx 9y agoI didn't expect TypeScript to be a problem. I was more worried about not understanding other code and libraries that are written in JavaScript style. It seems a lot of design patterns used in the JavaScript world make sense once you understand the strengths and weaknesses of JavaScript.
- mercer 9y agoYou'll need to understand JavaScript. One of the things I like about TypeScript is that it tries to 'fit' JavaScript, but the consequence is that you need to understand JavaScript to be proficient in TypeScript. That said, I suspect it won't be too difficult, and quite worth your while, to learn 'idiomatic JavaScript' if you have experience with at least one other language. And especially with ES6 (which is 'included' in TS), if you have any experience with Ruby or Python you'll be fine with JS and it might even be a relatively pleasant experience.
- kevindqc 9y agoTypescript is very similar to ES6 (new JavaScript). You can probably learn both with TS. You might not learn the weird JS quirks if you have to go back to ES5 at some point though.
- livingparadox 9y agoTypeScript is, strictly, a superset of javascript. You probably could "jump directly to TypeScript" but you would not be able to "skip learning JavaScript" as TypeScript is based off the concepts in JS. That being said, I don't see why you couldn't learn them concurrently; you can learn the basics of TypeScript and then simply rewrite any relevant JS example code into TypeScript to learn JS code in a TS context. Edit: I should also point out that integrating with any JS libraries may require you to install the '@types/' package alongside it to maintain type-safety. For example, if you're using jQuery, you can install the '@types/jquery' package which will expose all the type information for the jquery package.
- mercer 9y agoThe downside of going straight for TS is that it's a bit more work to figure out how to build and debug (with sourcemaps) if you're not too familiar with front-end development. On the other hand the upside, and a very big one, is that if you set up the relatively simple TS build process, you automatically get all the ES2015+ stuff for free, even without needing to figure out Webpack and Babel and the like (with some caveats front-end-wise, primarily Promises and Fetch).
- wvenable 9y ago> Does this make sense or is it feasible to skip learning JavaScript and jump directly to TypeScript? It's definitely feasible and it will even save a few headaches. It's especially good for learning the API because, of course, it provides intellisense. I find myself downloading type definitions for JavaScript libraries because it's often a quicker form of documentation than the library's official docs. > I was more worried about not understanding other code and libraries that are written in JavaScript style. There isn't much stylistic difference; TypeScript is not a huge departure from JavaScript.
- TheAceOfHearts 9y agoYou need to understand JavaScript and the ecosystem. Even if you're going to be writing TypeScript, other people will probably be using regular JavaScript. But TypeScript is a superset of JavaScript, so it shouldn't be very difficult to pick it up. You need to learn to crawl before you can walk, as they say. If you want to develop an in-depth understanding of the language, I suggest reading through the ExploringJS [0] series. It covers pretty much every single edge case and detail. You don't have to read each book cover-to-cover, you can just skim parts you're familiar with. To give you an idea of how awesome it is... Exploring ES6 is my go-to reference for anything related to ES6. When I first discovered the book I'd already been writing ES6 code for a while, and I thought I knew everything there was to know about it. But upon reading it, I was blown away by how many things I hadn't been aware of. [0] http://exploringjs.com http://exploringjs.com