Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Power Leveling your TypeScript

One Does Not… write TypeScript so easily! In this Meetup talk, I'll share the tricks and pain points I had to learn in my first 6 months of professional TypeScript. The goal is to spare the reader many hours of Stack Overflow...

5.
“I want code that compile”
« As an enterprise web application developer, I don't like any scripting or
dynamic languages. I like code that compiles (...) TypeScript looks like it will
help with some of the problems like having (...) compiling (…) » (somewhere on the net)
No. You are asking for a linter. All languages have linters.
JS already has an excellent linter: ESLlint
TypeScript also has a linter: TSLint
They will catch typos and code smells. Use a linter. Now.

6.
“Company BIG™ is using it”
● Created by Microsoft
● Embraced by Google: Angular 2
● Big contributions from Palantir (tslint, blueprint, …)
● Webpack is considering a rewrite in typescript
Following strong players’ lead may be a good move,
But could you make your own opinion ?

9.
Quick check
● Do you work in a team ? (3+)
● Do you have time right now ?
● Is it a long-term project or just a MVP ?
● Are you experienced ?
● Does your industry need the best ? (ex. Security)
● Do you like Typescript ?

10.
Don’t !
● Not a substitute for Unit Tests
● Not a substitute for Code Reviews
● Not a way to go back to your OOP comfort zone
– Please learn about functional programming
 A Gentle Introduction to Functional JavaScript

33.
Boss: “Dark Typings”
This boss can never be defeated, only repelled :-(

34.
Need to use a “declaration file” (aka “typing”)
● A special kind of TypeScript file which “annotate” some JS:
npm I -D @types/lodash
● You NEED them. But may not exist, not be correct, not be up-to-date
● @types picked automatically by the compiler (since typescript 2)
● Sometimes needed: import * as _ from ‘lodash’
● Write your own: official doc, tutorial (More about this in next talk !)
http://stackoverflow.com/questions/38224232/how-to-consume-npm-modules-from-typescript