'Is it possible declare type optionally in typescript?
I'm looking for something like this...
type B = a ? 'apple' | 'grape' | 'orange' : 'apple' | 'grape'; // Of course, ERROR!
const x = (a: boolean, b: B) => console.log('foo')
How can I implement this? Is it possible in Typescript?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
