I recently stumbled upon the following snippet:
type NamedProperty<Name extends string, T>
= { [_ in 0 as Name]: T }
This is later used like below:
type TargetPropertyGroup<Name extends string>
= NamedProperty<`has${Capitalize<Name>}Target`, boolean>
& NamedProperty<`${Name}Target`, Element>
& NamedProperty<`${Name}Targets`, Element[]>
Can anybody help me figure out what [_ in 0 as Name]
means?
I also found this bit in the playground but still...