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
Provide/Inject で TypeScript の恩恵を受ける方法
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
SAW
September 25, 2024
Programming
200
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Provide/Inject で TypeScript の恩恵を受ける方法
Vue 勉強会 in 大阪 の発表資料です。
SAW
September 25, 2024
More Decks by SAW
See All by SAW
Makefile 入門
azuki
0
110
Effortless API Documentation with Scribe
azuki
0
97
Laravelで手軽にAPIドキュメントを生成する ― Scribe活用術
azuki
0
74
🪝 便利な Property Hooks を 使ってみよう 🪝
azuki
0
110
決済システム超初心者が Stripe に入門している話
azuki
0
160
React Hook Form と Zod によるフォームバリデーション
azuki
0
83
PHP で form-data を POST 以外のメソッドで受け取るには?
azuki
0
97
PHP で学ぶ OAuth 入門
azuki
2
1.4k
EditorConfig を使ってみよう
azuki
1
130
Other Decks in Programming
See All in Programming
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
360
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
250
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
260
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
350
JRuby: Past, Present, and Future
headius
0
160
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
180
数年滞っていたダークモード対応をおよそ2週間で完了させる
chigichan24
0
730
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
アクセシビリティから考える情報設計
high_g_engineer
0
380
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
380
XP祭りでしか伝わらないフリップネタ #xpjug
murabayashi
0
150
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
160
Featured
See All Featured
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
510
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
700
Ruling the World: When Life Gets Gamed
codingconduct
0
340
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
910
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
300
Building the Perfect Custom Keyboard
takai
2
880
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
The Limits of Empathy - UXLibs8
cassininazir
1
680
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
How GitHub (no longer) Works
holman
316
150k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Transcript
1SPWJEF*OKFDUͰ5ZQF4DSJQUͷ ԸܙΛड͚Δํ๏ 7VFษڧձJOେࡕ 4"8
$(whoami) ࢯ໊Ճ౻फҰ ࡀ ϋϯυϧωʔϜ4"8 9 چ5XJUUFS !B[VLJ@FBUFS ؔͷ*5ΤϯδχΞίϛϡχςΟͷ͔͠୲ ࣗশ
େࡕࡏॅɾѪग़ ಘҙ8FCΞϓϦέʔγϣϯ։ൃ 7VF -BSBWFM ʮྫྷ͠த՚͡Ίͨ͠ʯฉ͘ͷʹ ʮྫྷ͠த՚ऴΘΓ·ͨ͠ʯฉ͔ͳ͍ͷ ͳͥͩΖ͏ ࠓͷ໎ݴ
ࢠଙͷίϯϙʔωϯτʹσʔλΛ͢ 7VF͔Β1SPWJEF*OKFDUͱ͍͏ػೳ͕Ճ ࢠଙͷίϯϙʔωϯτʹσʔλΛ͢߹ʹpropsͰόέπϦϨʔʹͳΔ 1SPWJEF*OKFDUΛར༻͢Δ͜ͱͰpropsͷόέπϦϨʔΛղফ ΞϓϦέʔγϣϯϨϕϧͰ1SPWJEFΛར༻͢Δ͜ͱͰ%*Λ࣮ݱ શͯͷίϯϙʔωϯτͰ*OKFDUΛ͢Δ͜ͱͰσʔλΛऔಘՄೳ ͋ΔίϯϙʔωϯτͰ1SPWJEFͨ͠߹ࢠଙͷίϯϙʔωϯτͰͷΈ*OKFDUՄೳ
1SPWJEF*OKFDUͷΠϝʔδ Header Layout Root Main Footer ArticleList ArticleEditor provide('user', me)
inject('user') inject()Մೳͳൣғ ઌͷίϯϙʔωϯτͰ provide()͢ΔσʔλΛొ ࢠଙͷίϯϙʔωϯτͰ inject()ͯ͠σʔλΛऔಘ
1SPWJEF*OKFDUͰ5ZQF4DSJQUͷԸܙΛड͚Δ Ωʔ͕จࣈྻͷ߹inject() ͷฦ٫ܕunknown inject()Ͱऔಘͨ͠σʔλͷܕΛࢦఆ͢ΔʹΩϟετ͕ඞཁ provide()ʹ͞ΕͨσʔλܕͱҟͳΔܕʹΩϟετͯ͠ΤϥʔʹͳΒͳ͍ ΩʔͷจࣈྻΛUZQP͍ͯͯ͠੩తղੳͰΤϥʔΛݕͰ͖ͳ͍ ΩʔʹInjectionKey<T>Λར༻͢Δ͜ͱͰܕใΛऔಘ inject()ͷฦ٫ܕT|undefinedʹͳΓΩϟετ͕ෆཁ ܕͷෆ߹ΩʔͷUZQPͳͲ͕͋Δ߹ʹ੩తղੳͷԸܙΛड͚ΒΕΔ
InjectionKey<T>ͷར༻ Layout Main ArticleEditor export const userInjectionKey = Symbol() as
InjectionKey<User>; import { userInjectionKey } from './InjectionKey'; const me: User = { name: 'Jack' }; provide(userInjectionKey, me); import { userInjectionKey } from './InjectionKey'; const me = inject(userInjectionKey); console.log(me?.name); Layout.vue ArticleEditor.vue InjectionKey.ts InjectionKey<User>ʹΩϟετͨ͠ SymbolΛFYQPSU inject()ͷฦ٫ܕ User|undefinedͱͳΔ
·ͱΊ 1SPWJEF*OKFDUʹ͍ͭͯͷ֓ཁΛઆ໌ 1SPWJEF*OKFDUͰ5ZQF4DSJQUͷԸܙΛड͚Δํ๏Λհ InjectionKey<T> ΛΩʔʹར༻͢Δ͜ͱͰ࣮ݱՄೳ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠