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
120
Effortless API Documentation with Scribe
azuki
0
110
Laravelで手軽にAPIドキュメントを生成する ― Scribe活用術
azuki
0
75
🪝 便利な Property Hooks を 使ってみよう 🪝
azuki
0
110
決済システム超初心者が Stripe に入門している話
azuki
0
170
React Hook Form と Zod によるフォームバリデーション
azuki
0
89
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
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
490
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
450
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
450
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.9k
Verilogで学ぶCPU自作入門.pdf
uyuki234
8
4k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
230
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
150
ジョジョの世界をXRで再現する
mofurune
0
130
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
1.9k
SREの越境 / SRE Collaboration
y0hgi
2
300
SalesForceを内製化!? ~ HR事業を支える顧客管理基盤のインフラを大公開 ~
oku053
0
140
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
550
Designing for Performance
lara
612
70k
The Invisible Side of Design
smashingmag
301
52k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
68
58k
Skip the Path - Find Your Career Trail
mkilby
1
240
A Tale of Four Properties
chriscoyier
163
24k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
350
Evolving SEO for Evolving Search Engines
ryanjones
0
310
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
530
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
550
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> ΛΩʔʹར༻͢Δ͜ͱͰ࣮ݱՄೳ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠