A lot of times where you do have essentially these static objects of data. By being able to Make the type to follow that directly. I think that seems pretty powerful and like we mentioned off the top this isn't gonna be something I'm gonna be reaching for all the time, but there are times Specifically when I would give this a type. It's like oh, it's a grouping of records or whatever Right and what string values? That tells me very little about what's actually in this Object or what this this data actually is.
In this Hasty Treat, Scott and Wes talk about Satisfies and as const.
Show Notes
export const currencies = { USD: 'US Dollars', CAD: 'Canadian Dollar', EUR: 'Euro', } as const; export type Currency = typeof currencies; export type CurrencyCode = keyof Currency;
Tweet us your tasty treats