-
Notifications
You must be signed in to change notification settings - Fork 928
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: SchemaDescription no longer exported #1144
Comments
happy to take PR that exports it. lots of types probably are missing that are worth exporting! |
@jquense, this issue is a couple of years old, but these types seem to be importable in the latest stable Yup but not importable in the latest Yup beta. Would I be okay to repurpose this issue to fix it in the Yup beta, or should this issue be closed and a new one for the beta problem created? |
yeah go for it 👍 this is issue is fine to hijack |
For anyone looking for a quick way to get these types in the beta version, this is how I did it: import * as yup from 'yup'
// The beta version of yup doesn't export these types, so we have to extract them ourselves...
export type SchemaFieldDescription = ValueOf<ReturnType<yup.AnyObjectSchema['describe']>['fields']>
export type SchemaRefDescription = Extract<SchemaFieldDescription, { type: 'ref' }>
export type SchemaInnerTypeDescription = Extract<SchemaFieldDescription, { innerType?: SchemaFieldDescription }>
export type SchemaObjectDescription = Extract<SchemaFieldDescription, { fields: Record<string, SchemaFieldDescription> }>
export type SchemaDescription = Exclude<Exclude<Extract<SchemaFieldDescription, { optional: boolean }>, { innerType?: SchemaFieldDescription }>, { fields: Record<string, SchemaFieldDescription> }>
export type Reference = Extract<ValueOf<yup.AnyObjectSchema['fields']>, { __isYupRef: boolean }>``` |
Describe the bug
It appears that e.g.
SchemaDescription
are no longer exported.Is this on purpose? The README on the other hand still lists it here.
So it seems to not just be an internal type.
To Reproduce
Expected behavior
It should not be required to be importing from internal
lib
folder whatsoever.import { SchemaDescription } from 'yup'
Platform (please complete the following information):
The text was updated successfully, but these errors were encountered: