interfaceの冗長な宣言をなんとかしたい
IInputOption['xxx']
をまとめたい
typescript
1// 使いまわしたい interface 2interface IInputOption { 3 placeholder?: string 4 disabled?: boolean 5 // ... 以下続く 6} 7 8 9// InputOption を利用 10interface IFoo { 11 foo: string // ここが差分 12 13 placeholder: InputOption['placeholder'] 14 disabled: InputOption['disabled'] 15} 16 17// InputOption を利用 18interface IBar { 19 bar: string // ここが差分 20 21 placeholder: InputOption['placeholder'] 22 disabled: InputOption['disabled'] 23} 24 25interface IBoo { 26 boo: string // ここが差分 27 28 Map<IInputOption> // こんな感じのを見たことあるきがするが... 29}
interfaceテクを見せてください...
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/26 14:01