Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
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
750
0
Share
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
120
How to Learn 3
airportyh
2
100
How to Learn 2
airportyh
0
110
How To Learn
airportyh
7
1.5k
Test-Driven Development that Feels Great
airportyh
0
8.8k
Other Decks in Programming
See All in Programming
さぁV100、メモリをお食べ・・・
nilpe
0
120
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
130
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
2.7k
TSKaigi 2026 TypeScriptバックエンドのオブザーバビリティ戦略 — Datadog × NestJSの実践
taiseiyamamotoan
1
210
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
1k
次世代リンターで探る、tsgo 時代における型認識カスタムルールの現実解
ytakahashii
3
1.4k
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
2
1.1k
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
1.2k
Talking to terminals (and how they talk back) (KotlinConf 2026)
jakewharton
PRO
1
170
3Dシーンの圧縮
fadis
1
570
GitHub Copilot CLIのいいところ
htkym
2
1.2k
Inside Stream API
skrb
1
520
Featured
See All Featured
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
590
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.3k
How STYLIGHT went responsive
nonsquared
100
6.2k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Documentation Writing (for coders)
carmenintech
77
5.4k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
280
sira's awesome portfolio website redesign presentation
elsirapls
0
270
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Building Applications with DynamoDB
mza
96
7.1k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
A Modern Web Designer's Workflow
chriscoyier
698
190k
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