strange loop 2017 - typescript 101 (extended)

34
A brief class that introduces the benefits TypeScript provides to large scale projects. Prerequisites: JavaScript 202 TypeScript 101

Upload: frances-coronel

Post on 23-Jan-2018

78 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Strange Loop 2017 - TypeScript 101 (Extended)

A brief class that introduces the benefits TypeScript provides to large scale projects.

Prerequisites: JavaScript 202

TypeScript 101

Page 2: Strange Loop 2017 - TypeScript 101 (Extended)

TypeScript

Page 3: Strange Loop 2017 - TypeScript 101 (Extended)

🎓 Professor Frances Coronel

@fvcproductions

fvcproductions

in/fvcproductions

Page 4: Strange Loop 2017 - TypeScript 101 (Extended)

Syllabus(1) TypeScript vs JavaScript 🎭

(2) The Rise of TypeScript’s Popularity 📈

(3) Homework Assignments 📚

Page 5: Strange Loop 2017 - TypeScript 101 (Extended)

W8, what is TypeScript? 🤔• free & open-source programming language

developed & maintained by Microsoft

• strict syntactical superset of JavaScript

• eases development of large scale applications written in JavaScript

• extends JavaScript by adding static types, classes, modules, interfaces & generics👶 5 years old

Page 6: Strange Loop 2017 - TypeScript 101 (Extended)

(1) TypeScript vs JavaScript 🎭

.ts .js

Page 7: Strange Loop 2017 - TypeScript 101 (Extended)

The Nitty Gritty 💻npm i -g typescript

Installing TypeScript

Compiling our file to JS

tsc multiplication.ts

Configuring options

touch tsconfig.json

npm i -g tslint

Optional Installing TSLint

Page 8: Strange Loop 2017 - TypeScript 101 (Extended)

JavaScript is TypeScript but TypeScript is not JavaScript.

Superset vs Subset 🔘

Page 9: Strange Loop 2017 - TypeScript 101 (Extended)

1. Referenced a symbol/variable which is not declared in program

2. Not able to fully infer the type of a particular variable and warns against using it as is

3. Even if your source code has TypeScript errors, it will still produce JavaScript code which you can execute

Spell Checker

Page 10: Strange Loop 2017 - TypeScript 101 (Extended)

What Types Provide

✓ modular development ✓ can be learned easily ✓ non-invasive ✓ long-term vision ✓ clean output

To Type or Not To TypePros of JavaScript

• EVERYWHERE • awesome libraries • flexible

Cons of JavaScript

• dynamic typing • lack of modularity • verbose patterns

Page 11: Strange Loop 2017 - TypeScript 101 (Extended)

(2) The Rise of TypeScript’s Popularity 📈

Page 12: Strange Loop 2017 - TypeScript 101 (Extended)
Page 13: Strange Loop 2017 - TypeScript 101 (Extended)

Companies ❤ TypeScript

Page 14: Strange Loop 2017 - TypeScript 101 (Extended)

Developers ❤ TypeScript

Page 15: Strange Loop 2017 - TypeScript 101 (Extended)
Page 16: Strange Loop 2017 - TypeScript 101 (Extended)
Page 17: Strange Loop 2017 - TypeScript 101 (Extended)

(3) Homework Assignments 📚

Page 18: Strange Loop 2017 - TypeScript 101 (Extended)

Option 1. 🎥 Watch the creator of TypeScript talk about TypeScript at the #MSBuild Conference

“What’s New In TypeScript” by Anders Hejlsberg

Page 19: Strange Loop 2017 - TypeScript 101 (Extended)

Option 2. 🎓 Enroll in an edX course on TypeScript created by Microsoft that starts tomorrow

Page 20: Strange Loop 2017 - TypeScript 101 (Extended)

Option 3. 🎮 Screw homework and go play instead!

typescriptlang.org/play

Page 21: Strange Loop 2017 - TypeScript 101 (Extended)

Thanks for listening! ☺

@fvcproductions

fvcproductions

in/fvcproductions

Slides will be uploaded ASAP at

speakerdeck.com/fvcproductions

Page 22: Strange Loop 2017 - TypeScript 101 (Extended)

Credits1. Mathematical Finn Photo: https://glarbinator.deviantart.com/art/Mathematical-Finn-417768395

2. TypeScript Official Website: http://www.typescriptlang.org/

3. Severus Snape Video: https://www.youtube.com/watch?v=PnOyBLT07R8

4. GitHub Icon: https://www.iconfinder.com/iconsets/ionicons

5. Twitter & LinkedIn Icons: https://www.iconfinder.com/iconsets/free-social-icons

6. Fonts: Segoe UI, SF Pro Text, Input Mono

7. Google Trends: https://g.co/trends/2M11R

8. TypeScript and JavaScript Logos: egghead.io

9. Stack Overflow 2017 Survey: https://insights.stackoverflow.com/survey/2017

10. TypeScript GIFs: http://twittervideodownloader.com/ & @typescriptlang

11. EdX Course: https://www.edx.org/course/introduction-typescript-2-microsoft-dev273x-0#!

12. List of Editors: https://www.wikiwand.com/en/TypeScript

Page 23: Strange Loop 2017 - TypeScript 101 (Extended)

Appendix

Page 24: Strange Loop 2017 - TypeScript 101 (Extended)
Page 25: Strange Loop 2017 - TypeScript 101 (Extended)

Why all the love?

1. Modular structure

2. Friendly with all editors

3. Scalable

4. Easy to learn

5. Easy to debug so less bugs!

1. Has Types

2. Good tooling and library support

3. Powers major production apps

4. Devs can be onboard fairly quickly

5. Should work on both client and server

😍

Page 26: Strange Loop 2017 - TypeScript 101 (Extended)

Evaluating the Popularity of a Programming Language 🤓

Page 27: Strange Loop 2017 - TypeScript 101 (Extended)
Page 28: Strange Loop 2017 - TypeScript 101 (Extended)

15 Most Popular Languages

On GitHub by Opened Pull Requests

With Percentage Change from Previous Year

Page 29: Strange Loop 2017 - TypeScript 101 (Extended)

Bonus Chapter - Jingle Time! 🎵

• You know that one part of class you weren’t really expecting but that you ended up enjoying anyways?

• This is that part.

TypeScript 101

We just had so much fun

ECMAScript was not enough

We want JavaScript that scales

And with types and transpilation

There is no way we can fail

TypeScript is super anal

Plus we get way less bugs

Just useeeee TypeScript.

Page 30: Strange Loop 2017 - TypeScript 101 (Extended)

Abstract Syntax Trees (AST)

Page 31: Strange Loop 2017 - TypeScript 101 (Extended)

Extracting Functions

Page 32: Strange Loop 2017 - TypeScript 101 (Extended)
Page 33: Strange Loop 2017 - TypeScript 101 (Extended)
Page 34: Strange Loop 2017 - TypeScript 101 (Extended)

My somewhat morbid dog analogy

>