Chance @chance.dev · Dec 2

🔥 TypeScript tip: Infer types from a statically defined Set using `as const` and `infer`

32 likes 1 replies

?

Replies

@yuvalshimoni.bsky.social · Dec 2

Maybe I miss something, but this give you the same result: const buttonTypes=['a', 'b'] as const; type ButtonTypes = typeof buttonTypes[number]