strange loop 2017 - typescript 101 (extended)
TRANSCRIPT
A brief class that introduces the benefits TypeScript provides to large scale projects.
Prerequisites: JavaScript 202
TypeScript 101
TypeScript
🎓 Professor Frances Coronel
@fvcproductions
fvcproductions
in/fvcproductions
Syllabus(1) TypeScript vs JavaScript 🎭
(2) The Rise of TypeScript’s Popularity 📈
(3) Homework Assignments 📚
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
(1) TypeScript vs JavaScript 🎭
.ts .js
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
JavaScript is TypeScript but TypeScript is not JavaScript.
Superset vs Subset 🔘
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
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
(2) The Rise of TypeScript’s Popularity 📈
Companies ❤ TypeScript
Developers ❤ TypeScript
(3) Homework Assignments 📚
Option 1. 🎥 Watch the creator of TypeScript talk about TypeScript at the #MSBuild Conference
“What’s New In TypeScript” by Anders Hejlsberg
Option 2. 🎓 Enroll in an edX course on TypeScript created by Microsoft that starts tomorrow
Option 3. 🎮 Screw homework and go play instead!
typescriptlang.org/play
Thanks for listening! ☺
@fvcproductions
fvcproductions
in/fvcproductions
Slides will be uploaded ASAP at
speakerdeck.com/fvcproductions
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
Appendix
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
😍
Evaluating the Popularity of a Programming Language 🤓
15 Most Popular Languages
On GitHub by Opened Pull Requests
With Percentage Change from Previous Year
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.
Abstract Syntax Trees (AST)
Extracting Functions
My somewhat morbid dog analogy
>