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
TypeScript から JavaScript への変換が見えやすくするビューワーを作った話...
Search
girigiribauer
April 03, 2019
Technology
1
630
TypeScript から JavaScript への変換が見えやすくするビューワーを作った話 / 20190403-typescript-studying
雑でごめんなさい
girigiribauer
April 03, 2019
Tweet
Share
More Decks by girigiribauer
See All by girigiribauer
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
46
移動は善 / 20260124-NGK2026S
girigiribauer
1
100
Google Antigravity を使ってみた肌感 / 20251130-ai-craft-hacks-niigata
girigiribauer
0
64
なんとなく使っていたクリップボードの不思議 / 20250926-niigata-5min-tech
girigiribauer
0
60
タスクにもストック型・フロー型があるということに Todoist を使い始めて気づいた話 / 20250725-niigata-5min-tech
girigiribauer
0
80
Bluesky のフィードを作ろう / 20250620-niigata-5min-tech
girigiribauer
0
55
『Bluesky 公式アカウント移行まとめ』のアップデートをした話 / 20241018-niigata-5min-tech
girigiribauer
0
120
コンテナクエリはコンテナ技術の話ではなく CSS の話です / 20240920-niigata-5min-tech
girigiribauer
1
100
公共交通のオープンデータ事始め / 20240823-niigata-5min-tech
girigiribauer
0
120
Other Decks in Technology
See All in Technology
ECS障害を例に学ぶ、インシデント対応に備えたAIエージェントの育て方 / How to develop AI agents for incident response with ECS outage
iselegant
5
810
意外と知ってそうでしらない、Reserved Instances の世界
mappie_kochi
0
160
今こそ学びたいKubernetesネットワーク ~CNIが繋ぐNWとプラットフォームの「フラッと」な対話
logica0419
9
770
衛星画像即時マッピングサービスの実現に向けて
lehupa
1
280
コミュニティが変えるキャリアの地平線:コロナ禍新卒入社のエンジニアがAWSコミュニティで見つけた成長の羅針盤
kentosuzuki
0
150
pool.ntp.orgに ⾃宅サーバーで 参加してみたら...
tanyorg
1
3k
LiDARが変えたARの"距離感"
zozotech
PRO
0
260
Claude Codeで実践するスペック駆動開発入門 / sdd-with-claude_code
yoshidashingo
2
2.7k
LLMOpsのこれまでとこれからを学ぶ
nsakki55
2
630
xDS を活用したサービスディスカバリーで実現するブランチ別 QA 環境の構築手法
knwoop
1
160
意志を実装するアーキテクチャモダナイゼーション
nwiizo
2
870
チーム開発の基礎_研究を事業につなげるために
cyberagentdevelopers
PRO
7
3.6k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
A Tale of Four Properties
chriscoyier
162
24k
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Facilitating Awesome Meetings
lara
57
6.8k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
160
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
Joys of Absence: A Defence of Solitary Play
codingconduct
1
290
Between Models and Reality
mayunak
1
210
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
72
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
72
Transcript
TypeScript から JavaScript への 変換が見えやすくする ビューワーを作った話 2019/04/03 TypeScript ษڧձ @girigiribauer
\ 沖縄から来ました /
ts2js-viewer を雑に作った • TypeScript ͕ JavaScript ʹͲͷΑ͏ʹ ม͞ΕΔ͔ɺखؒΛ͔͚ͣʹαΫοͱ ֬ೝ͍ͨ͠ •
https://ts2js-viewer.netlify.com/ ʹ্͛·ͨ͠
左に書いたら、右に出るやつ
変換が分かりやすい! • Enum ͷڍಈͱ͔ʢkey, value ͕ަޓʹೖΔʣ • ܕ͕શ෦֎ΕΔͱ͔ • async
/ await ͕ͿΘͬͱ͘ͳΔͱ͔ ࡶʹ࡞ͬͨϨϕϧͳͷͰɺ ϓϦηοτͷίʔυϕλॻ͖ͩ͠ɺ ʮ͜͏͍͏ม͋ͬͨํ͕͍͍Μ͡Όͳ͍ʁʯ Έ͍ͨͳͷ͕શવཏͰ͖ͯ·ͤΜ
How to use • import * as ts from “typescript";
Ͱ ࡶʹಡΈࠐΜͰͬͪΌ͏ • `npm i typescript` ͩͱ warning ͰͪΌ͏ global ʹΠϯετʔϧͨ͠ͷΛ `npm link` ͯ͠͏ͷ͕ຊདྷͷ͍ํͬΆ͍
Using the Compiler API • https://github.com/Microsoft/TypeScript/ wiki/Using-the-Compiler-API • ts.transpileModule(code, options)
͕γϯϓϧ • γϯϓϧʹม͢Δͭͷଞʹɺ நߏจ (AST) Λτϥόʔγϯάͯ͘͠ΕΔ ͭ͋ΔʢผͷػձͰ୭͔͕Δ…!ʣ
まとめ • Ͳ͏͍͏ϓϦηοτ͕͋ΔͱΑΓֶͼ͕͋Δ ͔ɺ୭͔ڭ͑ͯ΄͍͠ • ໊ݹͰʰϑϩϯτΤϯυ͘͘ձʱΛ ຖ݄ͬͯΔΑʂ͜͏͍͏ͷ͘͘͢Δͱ ͍͍Αʂ