is it possible to set something like this with typescript?
interface SomethingElse {}
type Fruits = {
banana: boolean,
apple: boolean,
melon: boolean,
//.... 1000 records
grape: boolean
}
const list: { [key: keyof fruits]: SomethingElse }
what i am trying to archive here is reuse the keys from fruits to create a new type that is no longer boolean, as you see i could create a new interface/type where i could assign the type as SomethingElse however that means i would need to duplicate all the fruits keys........
would it fit in a feature request? or you guys think this is non sense?
Seems like i missed the in as in const list: { [key in keyof fruits]: SomethingElse }
Most helpful comment
Seems like i missed the
inas inconst list: { [key in keyof fruits]: SomethingElse }