Closed nlfmt closed 1 month ago
Latest commit: 6dda722dee984f6adf35aca1599f1abda3c00551
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
When using
@typeschema/main
, a validation library other that typebox and its adapter, typeschema will try to infer all Schemas as typebox Schemas, due to theIsTypeboxSchema
type always returning true which is caused by a missing import of@sinclair/typebox
. A workaround is to install@sinclair/typebox
, which is not ideal for libraries. (See #63)My solution is to not use the
Kind
symbol to detect a Typebox Schema at the type level, but to use the propertiesstatic
andparams
that are guaranteed to be in the Typebox TSchema instead.I've run the tests and tried out the modified code with zod, suretype and typebox in various configurations, there seem to not be any issues.
I'm not quite sure how this works with Typebox' custom type system, but i couldn't find more documentation about their custom types for now