-
-
Notifications
You must be signed in to change notification settings - Fork 865
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
Typescript 4.9 satisfies
does not properly enforce enum on SomeJTDSchemaType
#2205
Comments
I don't see any downside to it, should be ok. Thank you. |
if it works ok, probably worth adding to tests / examples (once 4.9 is not the latest version:) |
Sorry, I meant that As this bug is purely related to typescript types, unless I am mistaken, I don't see a place to add relevant tests?
|
@epoberezkin Is there anything that still needs to be done to merge this in? It would be a super useful addition. |
Ajv version
8.12.0
Typescript 4.9 allows us to use the
satisfies
operator, which can be used to enforce the correctness of a schema throughSomeJTDSchemaType
before sending it toJTDDataType
:This feature does not work properly with
enum
types:In fact, in
types/jtd-schema.ts:14
, we see thatSomeJTDSchemaType
contains{enum: string[]}
, to whichreadonly [...]
cannot be assigned to.This seems fixable by simply changing the enum type in this file to
{enum: readonly string[]}
.Can I open a PR for that?
The text was updated successfully, but these errors were encountered: