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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
120
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
Getting Started with Vibe Coding
miccheng
0
190
小さなアプリを作って公開するまで
onozaty
0
140
FactoryBotをやめればRSpecは速くなるのか?
yuta_onishi_97
0
1.6k
Distance field of Julia set
kinakomoti321
0
300
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
220
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
410
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
150
React Native経験者が Flutterを30⽇間触って驚いたこと
3saito
0
160
TanStack Vue Query と Pinia Colada から学ぶ非同期状態の型設計
aoshi
0
630
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
110
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
220
オーケストレーション記述言語 Katari
yukikurage
0
240
Featured
See All Featured
A better future with KSS
kneath
240
18k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
550
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Exploring anti-patterns in Rails
aemeredith
4
560
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
The untapped power of vector embeddings
frankvandijk
2
2k
Typedesign – Prime Four
hannesfritz
42
3.2k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
400
Technical Leadership for Architectural Decision Making
baasie
3
640
The Illustrated Children's Guide to Kubernetes
chrisshort
51
53k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
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