Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
A Non-Zero Number of TypeScript Tips
Search
Toby Ho
August 20, 2018
Programming
760
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
A Non-Zero Number of TypeScript Tips
An introduction to TypeScript.
Toby Ho
August 20, 2018
More Decks by Toby Ho
See All by Toby Ho
Debugging Ajax Calls
airportyh
0
130
How to Learn 3
airportyh
2
110
How to Learn 2
airportyh
0
120
How To Learn
airportyh
7
1.6k
Test-Driven Development that Feels Great
airportyh
0
8.9k
Other Decks in Programming
See All in Programming
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
650
Verilogで学ぶCPU自作入門.pdf
uyuki234
7
3.9k
ハーネス設計入門 〜 基礎知識の整理から実務へのステップアップ 〜
kinopeee
19
20k
フロントエンドUIフレームワークのこれまでとこれから
ssssota
5
3.1k
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
320
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
140
SONY CISC-NEWS NWS-1750 + NWB-225 フレームバッファの NetBSD/news68k ドライバ実装 / OSC2026Hiroshima
tsutsui
0
160
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
150
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5.2k
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
30
13k
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
9.3k
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
330
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Technical Leadership for Architectural Decision Making
baasie
3
580
Game over? The fight for quality and originality in the time of robots
wayneb77
1
290
Tell your own story through comics
letsgokoyo
1
1.1k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
390
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
290
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Fireside Chat
paigeccino
43
4k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Practical Orchestrator
shlominoach
192
12k
So, you think you're a good person
axbom
PRO
2
2.2k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
300
Transcript
A non-zero number of TypeScript Tips
Agenda • What and why • Interfaces • Optional Properties
• Class • Generic functions / methods • Strict Null Checks • VS Code Shortcuts
What is TypeScript?
What is TypeScript • Super set of JavaScript / EcmaScript
• EcmaScript Future Proof
Why TypeScript?
Type Definitions
Interfaces the shape of an object
Interface
Interface
Interface
Interface
Implementing an Interface with a Class
Class Constructor Shorthand Equivalent shorthand to previous slide
Interface Extension
Optional Properties
None
None
Optional Properties This property is optional
Type assertion (or casting)
Type assertion (or casting) Don’t do this!!!
TypeScript Static type checking with loopholes.
Interface with Methods
Implementing an Interface with Methods
Generic Functions
Put a number in a list
Put a string in a list
Generic a thing in a list
Generic Function/Methods
Generic Function/Methods TypeScript knows!!!
Generic Types
Parameterized Types (generics) T is a type parameter
Parameterized Types
Parameterized Type: Promises
Promises Uses the fetch API
Promises
Promises Uses the fetch API
Generic Function with Generic Type!!!
Generic getItems
Generic getItems But what is articles? What is T?
Generic getItems
Generic getItems Define T explicitly
Generic getItems Or define related type and let TS infer
what T is
Generic getItems T is inferred to be IArticle based on
this related type declaration
Generic getItems
Strict Null Checks
Strict Null Checks This property is optional
Strict Null Checks tsconfig.json
Strict Null Checks
Strict Null Checks
Strict Null Checks
VS Code Help
VSCode Auto Import Helper
VSCode Auto Import Helper Click that!!!
VSCode Auto Import Helper
VSCode: Looking up type definitions Mac: Command+click Windows: Control+click Mac:
Command+hover Windows: Control+hover Popup: Drilldown:
Popup
Drilldown
Summary • What and why • Interfaces • Optional Properties
• Class • Generic functions / methods • Strict Null Checks • VS Code Shortcuts