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
Toby Ho
August 20, 2018
Programming
0
720
A Non-Zero Number of TypeScript Tips
An introduction to TypeScript.
Toby Ho
August 20, 2018
Tweet
Share
More Decks by Toby Ho
See All by Toby Ho
Debugging Ajax Calls
airportyh
0
100
How to Learn 3
airportyh
2
81
How to Learn 2
airportyh
0
97
How To Learn
airportyh
7
1.4k
Test-Driven Development that Feels Great
airportyh
0
8.8k
Other Decks in Programming
See All in Programming
RailsGirls IZUMO スポンサーLT
16bitidol
0
190
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
2
11k
20250704_教育事業におけるアジャイルなデータ基盤構築
hanon52_
5
880
코딩 에이전트 체크리스트: Claude Code ver.
nacyot
0
840
明示と暗黙 ー PHPとGoの インターフェイスの違いを知る
shimabox
2
580
初学者でも今すぐできる、Claude Codeの生産性を10倍上げるTips
s4yuba
16
12k
AI駆動のマルチエージェントによる業務フロー自動化の設計と実践
h_okkah
0
190
PHP 8.4の新機能「プロパティフック」から学ぶオブジェクト指向設計とリスコフの置換原則
kentaroutakeda
2
990
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
800
Google Agent Development Kit でLINE Botを作ってみた
ymd65536
2
260
スタートアップの急成長を支えるプラットフォームエンジニアリングと組織戦略
sutochin26
1
6.5k
What's new in AppKit on macOS 26
1024jp
0
130
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Scaling GitHub
holman
460
140k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
Why Our Code Smells
bkeepers
PRO
336
57k
Measuring & Analyzing Core Web Vitals
bluesmoon
7
510
Designing for Performance
lara
610
69k
For a Future-Friendly Web
brad_frost
179
9.8k
BBQ
matthewcrist
89
9.7k
jQuery: Nuts, Bolts and Bling
dougneiner
63
7.8k
Done Done
chrislema
184
16k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
830
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
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