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
620
TypeScript から JavaScript への変換が見えやすくするビューワーを作った話 / 20190403-typescript-studying
雑でごめんなさい
girigiribauer
April 03, 2019
Tweet
Share
More Decks by girigiribauer
See All by girigiribauer
Google Antigravity を使ってみた肌感 / 20251130-ai-craft-hacks-niigata
girigiribauer
0
52
なんとなく使っていたクリップボードの不思議 / 20250926-niigata-5min-tech
girigiribauer
0
44
タスクにもストック型・フロー型があるということに Todoist を使い始めて気づいた話 / 20250725-niigata-5min-tech
girigiribauer
0
74
Bluesky のフィードを作ろう / 20250620-niigata-5min-tech
girigiribauer
0
51
『Bluesky 公式アカウント移行まとめ』のアップデートをした話 / 20241018-niigata-5min-tech
girigiribauer
0
110
コンテナクエリはコンテナ技術の話ではなく CSS の話です / 20240920-niigata-5min-tech
girigiribauer
1
92
公共交通のオープンデータ事始め / 20240823-niigata-5min-tech
girigiribauer
0
110
私と Vim / 20240426-niigata-5min-tech
girigiribauer
2
200
がんばらない勉強会の続け方 / 20240426-niigata-5min-tech-omake
girigiribauer
1
570
Other Decks in Technology
See All in Technology
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
『君の名は』と聞く君の名は。 / Your name, you who asks for mine.
nttcom
1
140
_第4回__AIxIoTビジネス共創ラボ紹介資料_20251203.pdf
iotcomjpadmin
0
170
SES向け、生成AI時代におけるエンジニアリングとセキュリティ
longbowxxx
0
290
AI との良い付き合い方を僕らは誰も知らない (WSS 2026 静岡版)
asei
1
210
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
2025年のデザインシステムとAI 活用を振り返る
leveragestech
0
680
AWS re:Invent 2025 を振り返る
kazzpapa3
2
110
[Data & AI Summit '25 Fall] AIでデータ活用を進化させる!Google Cloudで作るデータ活用の未来
kirimaru
0
4.2k
投資戦略を量産せよ 2 - マケデコセミナー(2025/12/26)
gamella
1
600
Oracle Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
2
670
20251225_たのしい出張報告&IgniteRecap!
ponponmikankan
0
110
Featured
See All Featured
Optimizing for Happiness
mojombo
379
70k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
110
The Language of Interfaces
destraynor
162
26k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
132
19k
The SEO Collaboration Effect
kristinabergwall1
0
320
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
38
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
250
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) Λτϥόʔγϯάͯ͘͠ΕΔ ͭ͋ΔʢผͷػձͰ୭͔͕Δ…!ʣ
まとめ • Ͳ͏͍͏ϓϦηοτ͕͋ΔͱΑΓֶͼ͕͋Δ ͔ɺ୭͔ڭ͑ͯ΄͍͠ • ໊ݹͰʰϑϩϯτΤϯυ͘͘ձʱΛ ຖ݄ͬͯΔΑʂ͜͏͍͏ͷ͘͘͢Δͱ ͍͍Αʂ