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
Snowflakeで業務アプリを作ろう。 Snowflakeのアプリ機能解説&実践ガイド
ayumu_yamaguchi
1
190
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
130
フロントエンドUIフレームワークのこれまでとこれから
ssssota
2
1.4k
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
LoopHub - ローカルで動く GitHub で、AI と共同開発
jugyo
1
470
週末にAI-DLCを本気で回したら$1,600溶けた
hbashimizu
0
130
「AI時代、配布するPythonコードをどう守るか: 難読化の実験と判断軸」 #PyconJP2026
pkshadeck
PRO
2
190
Deep dive into the select statement (GopherCon UK)
jespino
0
170
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
170
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
480
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
640
Featured
See All Featured
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
590
What's in a price? How to price your products and services
michaelherold
247
13k
Done Done
chrislema
186
16k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
500
Abbi's Birthday
coloredviolet
3
9.9k
Why Our Code Smells
bkeepers
PRO
340
58k
GitHub's CSS Performance
jonrohan
1033
470k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
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