SlideShare a Scribd company logo


(heejongahn@gmail.com)
• .
• .
• http://ahnheejong.name/
• github, twitter @heejongahn
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• ?
• ?
• , ?
• ?
• , ?
• [ ] ?
• ?
• , ?
• [ ] ?
• ?
• ?
• , ?
• [ ] ?
• ?
• ?
• ?
• , ?
• [ ] ?
• ?
• ?
• ?
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기


(PR)


(PR)
💩
💩
💩
💩
💩
💩
💩
💩
💩
💩
💩
💩
PR
PR
…
PR
!
http://earlbarr.com/publications/typestudy.pdf
• ICSE’17 .
http://earlbarr.com/publications/typestudy.pdf
• ICSE’17 .
• 

.
http://earlbarr.com/publications/typestudy.pdf
• ICSE’17 .
• 

.
• “Github open issue


?”
http://earlbarr.com/publications/typestudy.pdf
,
.
“…using Flow or TypeScript
could have prevented 

15% of the public bugs 

for public projects on GitHub.”
“ .
10% , .
, . That’s
shocking. If you could make a change to the way we do development
that would reduce the number of bugs being checked in by 10% or
more overnight, that’s a no-brainer. Unless it doubles development
time or something, we’d do it.”
“ .
10% , .
, . That’s
shocking. If you could make a change to the way we do development
that would reduce the number of bugs being checked in by 10% or
more overnight, that’s a no-brainer. Unless it doubles development
time or something, we’d do it.”
“ .
10% , .
, . That’s
shocking. If you could make a change to the way we do development
that would reduce the number of bugs being checked in by 10% or
more overnight, that’s a no-brainer. Unless it doubles development
time or something, we’d do it.”
( TypeScript MS )
https://www.youtube.com/watch?v=KQevsm64wPY
• .
• .
• .
• .
• .
• .
• “ .”
• + IDE +
• , .
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
https://www.typescriptlang.org/ https://flow.org/
TypeScript Flow
Microsoft Facebook
2012.10.01 2014. 11. 19
Hyperconnect, Reddit, Tumblr, Slack, 

VS Code, Angular, … 

(http://www.typescriptlang.org/community/friends.html)
React, Vue, …
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• TypeScript Flow .
• TypeScript Flow .
• , .
• TypeScript Flow .
• , .
• 😇
• TypeScript Flow .
• , .
• 😇
• 👆 , .
• TypeScript Flow .
• , .
• 😇
• 👆 , .
• .
😥
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
•
• IDE
•
… because JavaScript was not designed
around a type system, Flow sometimes
has to make a tradeoff. When this
happens Flow tends to favor
soundness over completeness,
ensuring that code doesn’t have any
bugs.
(https://flow.org/en/docs/lang/types-and-expressions/#soundness-and-completeness-a-
classtoc-idtoc-soundness-and-completeness-hreftoc-soundness-and-completenessa)
Non-Goals: [...] Apply a sound or
"provably correct" type system.
Instead, strike a balance between
correctness and productivity.
(https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals)
Non-Goals: [...] Apply a sound or
"provably correct" type system.
Instead, strike a balance between
correctness and productivity.
(https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals)
“ 

” . 

.
… because JavaScript was not designed
around a type system, Flow sometimes
has to make a tradeoff. When this
happens Flow tends to favor
soundness over completeness,
ensuring that code doesn’t have any
bugs.
(https://flow.org/en/docs/lang/types-and-expressions/#soundness-and-completeness-a-
classtoc-idtoc-soundness-and-completeness-hreftoc-soundness-and-completenessa)


.
… because JavaScript was not designed
around a type system, Flow sometimes
has to make a tradeoff. When this
happens Flow tends to favor
soundness over completeness,
ensuring that code doesn’t have any
bugs.
(https://flow.org/en/docs/lang/types-and-expressions/#soundness-and-completeness-a-
classtoc-idtoc-soundness-and-completeness-hreftoc-soundness-and-completenessa)
Non-Goals: [...] Apply a sound or
"provably correct" type system.
Instead, strike a balance between
correctness and productivity.
(https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals)
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• alert ?
• alert ?
•
• alert ?
•
• !
• alert arg 

• alert arg 

• if
• alert arg 

• if
• ‘ ’ 



• Flow (soundness)
• Flow (soundness)
•
• Flow (soundness)
•
• const
• Flow (soundness)
•
• const
• ‘ ’
• Flow (soundness)
•
• const
• ‘ ’
•
[flow] number (This type is incompatible with 

an implicitly-returned undefined.)
[ts] Type '"JavaScript"' is not comparable
to type '"TypeScript" | "Flow"'.
•
• IDE
•
https://octoverse.github.com/
https://code.visualstudio.com/
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• TypeScript
• TS ?
• , Go To Definition IDE
• , Go To Definition IDE
• ( , ) (link)
• , Go To Definition IDE
• ( , ) (link)
• JSDoc
• TypeScript 2.5~
• JSDoc
• HTML <script>
• Zero configuration needed
• Flow
https://twitter.com/disjukr/status/924216888703426560
• , Go To Definition IDE
• ( , ) (link)
• JSDoc
• (link)
• , Go To Definition IDE
• ( , ) (link)
• JSDoc
• (link)
• …
•
• IDE
•
• https://eng.lyft.com/typescript-at-lyft-64f0702346ea
• https://eng.lyft.com/typescript-at-lyft-64f0702346ea
• lyft TypeScript
• https://eng.lyft.com/typescript-at-lyft-64f0702346ea
• lyft TypeScript
• (2017 9 28 )
• .
# of TypeScript Flow
StackOverflow
Github
(Open/Closed)
Github PR
(Open/Closed)
npm 

( + )
# of TypeScript Flow
StackOverflow ~ 38,000 ~ 900
Github
(Open/Closed)
Github PR
(Open/Closed)
npm 

( + )
# of TypeScript Flow
StackOverflow ~ 38,000 ~ 900
Github
(Open/Closed)
~2,400 / ~11,200 ~1,500 / ~2,200
Github PR
(Open/Closed)
npm 

( + )
# of TypeScript Flow
StackOverflow ~ 38,000 ~ 900
Github
(Open/Closed)
~2,400 / ~11,200 ~1,500 / ~2,200
Github PR
(Open/Closed)
~100 / ~5,000 ~60 / ~1,200
npm 

( + )
# of TypeScript Flow
StackOverflow ~ 38,000 ~ 900
Github
(Open/Closed)
~2,400 / ~11,200 ~1,500 / ~2,200
Github PR
(Open/Closed)
~100 / ~5,000 ~60 / ~1,200
npm 

~7.2 million ~2.9 million
( + )
# of TypeScript Flow
StackOverflow ~ 38,000 ~ 900
Github
(Open/Closed)
~2,400 / ~11,200 ~1,500 / ~2,200
Github PR
(Open/Closed)
~100 / ~5,000 ~60 / ~1,200
npm 

~7.2 million ~2.9 million
( + )
~3,700 + 250k ~340 + 43k
# of TypeScript Flow
StackOverflow ~ 38,000 ~ 900
Github
(Open/Closed)
~2,400 / ~11,200 ~1,500 / ~2,200
Github PR
(Open/Closed)
~100 / ~5,000 ~60 / ~1,200
npm 

~7.2 million ~2.9 million
( + )
~3,700 + 250k ~340 + 43k
https://octoverse.github.com/
# of TypeScript Flow
StackOverflow ~ 38,000 ~ 900
Github
(Open/Closed)
~2,400 / ~11,200 ~1,500 / ~2,200
Github PR
(Open/Closed)
~100 / ~5,000 ~60 / ~1,200
npm 

~7.2 million ~2.9 million
( + )
~3,700 + 250k ~340 + 43k
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• …
• LoC Flow TypeScript .
• .
• .
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
“Love for TypeScript” (https://github.com/Microsoft/TypeScript/issues/10011)
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• Plain JavaScript
• Flow
• npm install -g typescript
• my-cool-lib
•
• npm install my-cool-lib @types/my-cool-lib
•
• , , , /
, , …
• https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
•
• , , / ,
, …
• —allowSyntheticalDefaultImport
• —strict 

= —noImplicitAny + —noImplicitThis + —alwaysStrict 

+ —strictNullCheck + —strictFunctionType
• —lib, —target
• .
• https://www.typescriptlang.org/docs/handbook/compiler-options.html
• MS
•
• ts-loader(https://github.com/TypeStrong/ts-loader)
• awesome-typescript-loader(https://github.com/s-panferov/
awesome-typescript-loader)
• awesome-typescript-loader ( )
• https://
stackoverflow.com/
questions/tagged/
typescript
https://www.typescriptlang.org/

samples/index.html
https://github.com/Microsoft/TypeScriptSamples/
https://github.com/Microsoft/TypeScript/wiki
• https://www.typescriptlang.org/
docs/handbook/declaration-files/
introduction.html
• 

• .js(x), .ts(x)
(e.g. css-in-js)
• .
• .
• .
• .
• .
• .
• myScript.js -> myScript.ts
• myComponent.jsx -> myScript.tsx
• JS TS
• ( ) or
• TS JS
• 1.8~: —allowJs
• 2.3~: —checkJs JS – JSDoc 

https://github.com/Microsoft/TypeScript/wiki/Type-Checking-JavaScript-Files
•
•
•
•
• 

• 

• /


https://commons.wikimedia.org/wiki/File:Community_Immunity.jpg
→
•
• + /
• +
•
• flow-bin -> tsc
•
• babel-preset-flow
•
• Flow: ES6 

(import type { MyType } import { type MyType } )
• TS: ES6 (import { MyType })
•
• Flow: type Animal = { name: string }
• TS: interface Animal { name: string; }
•
• Flow: type Dog = Animal & { bark: () => void }
• TS: interface Dog extends Animal { bark: () => void; }
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
•
• : TS
•
• : TS
•
• TS “ … ”
•
• : TS
•
• TS “ … ”
•
• ! !
• JS(babel-loader) + TS(awesome-ts-loader)
• Flow + —allowJS
• `in`
• TS JS TS babel-loader
• TS JS TS babel-loader
• babel-transform-runtime
• TS JS TS babel-loader
• babel-transform-runtime
• TS JS Map, Set
• TS JS TS babel-loader
• babel-transform-runtime
• TS JS Map, Set
•
• Global State
• babel
• —allowJs Flow JS
• error TS8010: 'types' can only be used in a .ts file.
• https://github.com/flowtype/flow-remove-types
• flow
•
• … ( )
• https://github.com/Microsoft/
TypeScript/issues/10485
• 

• Workaround 1

-> Disjoint Union
• Workaround 2

-> hasKey ( @pelotom)
• optional X
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• ?
• , ?
• TypeScript ?
• ?
• ?
• ?
• , .
• , TypeScript .
• , .
• Webpack .
• .
• , . !
. .
• , .
• , TypeScript .
• , .
• Webpack .
• .
• , . !
ahnheejong.name | github.com/hejeongahn | twitter.com/heejongahn
TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기
• To Type or Not to Type: Quantifying Detectable Bugs in JavaScript
• TypeScript Design Goals
• Github Octoverse 2017
• Trade-offs in Control Flow Analysis #9998
• Treat `in` operator as type guard #10485
• Various TypeScript & VS Code release notes
• Why We Chose TypeScript
• TypeScript at Lyft
• Flow and TypeScript
• TypeScript vs. Flow
• Flow vs. TypeScript
• Type Systems for JavaScript: Elm, Flow, and TypeScript

More Related Content

PDF
Python intro
PDF
Ruby on Rails Presentation
PPT
PYTHON - TKINTER - GUI - PART 1.ppt
PPTX
脱RESTful API設計の提案
PDF
쿠키런 1년, 서버개발 분투기
PDF
고려대학교 컴퓨터학과 특강 - 대학생 때 알았더라면 좋았을 것들
PDF
Java + React.jsでSever Side Rendering #reactjs_meetup
PDF
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기
Python intro
Ruby on Rails Presentation
PYTHON - TKINTER - GUI - PART 1.ppt
脱RESTful API設計の提案
쿠키런 1년, 서버개발 분투기
고려대학교 컴퓨터학과 특강 - 대학생 때 알았더라면 좋았을 것들
Java + React.jsでSever Side Rendering #reactjs_meetup
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기

What's hot (20)

PDF
Methods in Java
PPTX
Basics of Object Oriented Programming in Python
PDF
ReactJS presentation
PPT
Collection Framework in java
PDF
Jpa 잘 (하는 척) 하기
PDF
Events and Listeners in Android
PDF
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)
PPTX
smarthrを支えるインフラ
PPTX
Java でつくる 低レイテンシ実装の技巧
PDF
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
PPTX
Fundamentals of Python Programming
PPS
Wrapper class
PDF
중니어의 고뇌: 1인분 개발자, 다음을 찾아서
PPT
programming with python ppt
PDF
MySQLバックアップの基本
PDF
Getting started with Next.js
PDF
Reactive extensions入門v0.1
PPTX
Java script
PPTX
Class, object and inheritance in python
PPTX
Introduction to the basics of Python programming (part 1)
Methods in Java
Basics of Object Oriented Programming in Python
ReactJS presentation
Collection Framework in java
Jpa 잘 (하는 척) 하기
Events and Listeners in Android
20200303 AWS Black Belt Online Seminar AWS Cloud Development Kit (CDK)
smarthrを支えるインフラ
Java でつくる 低レイテンシ実装の技巧
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
Fundamentals of Python Programming
Wrapper class
중니어의 고뇌: 1인분 개발자, 다음을 찾아서
programming with python ppt
MySQLバックアップの基本
Getting started with Next.js
Reactive extensions入門v0.1
Java script
Class, object and inheritance in python
Introduction to the basics of Python programming (part 1)
Ad

Viewers also liked (7)

PDF
Redis From 2.8 to 4.x
PDF
AWS Lambda를 기반으로한 실시간 빅테이터 처리하기
PDF
Python 게임서버 안녕하십니까 : RPC framework 편
PDF
인프런 - 스타트업 인프랩 시작 사례
PPTX
소프트웨어 공부하는법
PDF
Node.js API 서버 성능 개선기
PDF
책 읽어주는 딥러닝: 배우 유인나가 해리포터를 읽어준다면 DEVIEW 2017
Redis From 2.8 to 4.x
AWS Lambda를 기반으로한 실시간 빅테이터 처리하기
Python 게임서버 안녕하십니까 : RPC framework 편
인프런 - 스타트업 인프랩 시작 사례
소프트웨어 공부하는법
Node.js API 서버 성능 개선기
책 읽어주는 딥러닝: 배우 유인나가 해리포터를 읽어준다면 DEVIEW 2017
Ad

Similar to TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기 (20)

PDF
PDF
Flow or Type - how to React to that?
PDF
Safer JS Codebases with Flow
PDF
James Baxley - Statically typing your GraphQL app
PPTX
Static Type Checking with FlowJs
PDF
Helen Zhukova "JS static typing. What and why."
PPTX
SubmitJS: Is react + redux + typescript a good combination? Dmytro Beseda
PDF
Clean & Typechecked JS
PPTX
Getting started with typescript
PDF
TypeScriptについて
PPTX
HItchhickers Guide to TypeScript
PPTX
Type script - advanced usage and practices
PDF
Gabriele Petronella - FP for front-end development: should you care? - Codemo...
PDF
Introduction to TypeScript
PDF
Power Leveling your TypeScript
PDF
Structure on a freeform world
PDF
TypeScript 101 - We RISE Tech Conference
PDF
Programming TypeScript Making your JavaScript applications scale Boris Cherny
PDF
Introduction to typescript
PDF
Milano JS Meetup - Gabriele Petronella - Codemotion Milan 2016
Flow or Type - how to React to that?
Safer JS Codebases with Flow
James Baxley - Statically typing your GraphQL app
Static Type Checking with FlowJs
Helen Zhukova "JS static typing. What and why."
SubmitJS: Is react + redux + typescript a good combination? Dmytro Beseda
Clean & Typechecked JS
Getting started with typescript
TypeScriptについて
HItchhickers Guide to TypeScript
Type script - advanced usage and practices
Gabriele Petronella - FP for front-end development: should you care? - Codemo...
Introduction to TypeScript
Power Leveling your TypeScript
Structure on a freeform world
TypeScript 101 - We RISE Tech Conference
Programming TypeScript Making your JavaScript applications scale Boris Cherny
Introduction to typescript
Milano JS Meetup - Gabriele Petronella - Codemotion Milan 2016

More from Heejong Ahn (7)

PDF
플렉스팀 프론트엔드 기술 스택의 이해: `lint`, `build`, `run`
PDF
프로그래머의 배움
PDF
Being a Multiplier
PDF
Hello, React Hooks!
PDF
Pure UI
PDF
더 나은 팀을 위하여
PDF
Just Enough Category Theory for Haskell, part 1
플렉스팀 프론트엔드 기술 스택의 이해: `lint`, `build`, `run`
프로그래머의 배움
Being a Multiplier
Hello, React Hooks!
Pure UI
더 나은 팀을 위하여
Just Enough Category Theory for Haskell, part 1

Recently uploaded (20)

PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Encapsulation theory and applications.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Big Data Technologies - Introduction.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Encapsulation theory and applications.pdf
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Per capita expenditure prediction using model stacking based on satellite ima...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Big Data Technologies - Introduction.pptx
Machine learning based COVID-19 study performance prediction
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Understanding_Digital_Forensics_Presentation.pptx
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx

TypeScript와 Flow: 
자바스크립트 개발에 정적 타이핑 도입하기