How can I get "string & {}" in the inferred output type? #1175
Unanswered
jack-allocate
asked this question in
Q&A
Replies: 2 comments 10 replies
-
Since import * as v from 'valibot';
const fruits = v.union([
v.literal('apple'),
v.literal('banana'),
v.pipe(
v.string(),
v.uuid(),
v.transform((v) => v as typeof v & {}),
),
]);
type Out = v.InferOutput<typeof fruits>; |
Beta Was this translation helpful? Give feedback.
4 replies
-
Thanks for reaching out! What's the idea behind |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a schema like this:
and the output type infers to
string
which makes sense. I'd love it if there was a way for it to infer as"apple" | "banana" | (string & {})
.Playground
Beta Was this translation helpful? Give feedback.
All reactions