-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preflight validation check failed to guard for the given schema for Never()
since 1.2.21
#1129
Comments
You mean like this? query: t.Object({
test1: t.Array(t.Never(), { default: [] }),
test2: t.Optional(t.Never()),
test3: t.Array(
t.Union(
["123"].map((value) => t.Literal(value)),
{ default: [] },
),
),
}), |
@hisamafahri Yeah, a |
The But this is a typebox issue. And it's kinda make sense why this error happens (even though the Typebox's error message not really descriptive). Why? Because you use Typescript's What's your actual intention on those type here? |
This error only happens in elysia ^1.2.21, it doesn't happen in <= 1.2.20 or in TypeBox itself. So it's not a TypeBox issue in that case.
Exactly, and it literally means "a field may not be passed at all", so if you don't pass anything to this field then you're fine and you should have no errors.
I have something similar to |
I still am not sure why you want But yeah confirm that it breaks on |
is cleaner than
|
What version of Elysia is running?
1.2.25
What platform is your computer?
Darwin 23.5.0 arm64 arm
What steps can reproduce the bug?
t.Never()
, i.e.:What is the expected behavior?
test1
should always be an empty array with no errors unless a value is explicitly passed;test2
should behave the same way except the value itself isnever
;test3
should produce either an array containing a union of literals or justnever[]
when there's no data for literals.What do you see instead?
A 'Preflight validation check failed to guard for the given schema' error occurs if a schema references
never
in any way, either directly or indirectly.Additional information
It has been broken since
1.2.21
.1.2.20
worked fine and conformed to the expected behavior.Have you try removing the
node_modules
andbun.lockb
and try again yet?No response
The text was updated successfully, but these errors were encountered: