You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CheapestReturnMiles: Record<CabinClass, { miles: number; tax: number }>;
The current output fails typescript compliation, since we have CabinClass defined as type CabinClass = 'Economy' | 'First', and typescript doesnt allow literal types as index signatures.
Alternatively a mapped type could be used here:
CheapestReturnMiles: { [key in CabinClass]: { miles: number; tax: number } };
The text was updated successfully, but these errors were encountered:
minism
changed the title
Use Record for map types
Use Record or mapped types for map
Mar 7, 2024
I'd like to be able to generate either a
Record
or a typescript mapped type for a golang map type.Example:
Config:
Current output:
Expected output:
The current output fails typescript compliation, since we have
CabinClass
defined astype CabinClass = 'Economy' | 'First'
, and typescript doesnt allow literal types as index signatures.Alternatively a mapped type could be used here:
The text was updated successfully, but these errors were encountered: