Can we get inferred types that know the values of a union of literals? #922
-
I've got a schema like this: export const RecognitionOrderSchema = union([
...range(1, 20).map(literal),
] as const);
export type RecognitionOrder = InferOutput<typeof RecognitionOrderSchema>; Things work but when I reference the Is there a way to infer a type that spits out the expanded union of literals instead of just |
Beta Was this translation helpful? Give feedback.
Answered by
brandonpittman
Nov 13, 2024
Replies: 1 comment 2 replies
-
Turns out if I manually add each literal value instead of generating them, the inferred types have real unions. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
brandonpittman
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns out if I manually add each literal value instead of generating them, the inferred types have real unions.