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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
99
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.5k
EditorConfig を使ってみよう
azuki
1
130
Other Decks in Programming
See All in Programming
一人だけ、Kiroが静止する日
hideg
0
130
Jetpack Compose メカニズム
skydoves
0
480
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
300
Workers Cache を知る
syumai
0
270
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
4
3.9k
Java 27新機能 / Java 27 new features
kishida
2
170
JRuby: Past, Present, and Future
headius
0
200
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
360
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
260
世界の中心で、AI(App Intents)をさけぶ ー App Intents中心設計の実践ガイド
touyou
0
680
Go × SIMDで高速化するベクトル検索 ~ルーフラインモデルでSIMDが効く境界を探れ! ~
po3rin
1
3.7k
カツオ、ご期待ください
suneo3476
0
100
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6.3k
4 Signs Your Business is Dying
shpigford
187
23k
Typedesign – Prime Four
hannesfritz
42
3.2k
Done Done
chrislema
187
17k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
How to make the Groovebox
asonas
2
2.5k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
540
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.8k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
420
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
330
Tell your own story through comics
letsgokoyo
1
1.1k
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> ΛΩʔʹར༻͢Δ͜ͱͰ࣮ݱՄೳ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠