Skip to content
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

feat: Allow schema metadata to be strongly typed #2021

Merged
merged 2 commits into from
Jun 15, 2023

Conversation

shaungrady
Copy link
Contributor

Resolves #2018.

Allows schema metadata to be strongly typed through declaration merging. From the updated README.md:

A custom SchemaMetadata interface can be defined through
merging
with the CustomSchemaMetadata interface. Start by creating a yup.d.ts file
in your package and creating your desired CustomSchemaMetadata interface:

// yup.d.ts
import 'yup';
declare module 'yup' {
  // Define your desired `SchemaMetadata` interface by merging the
  // `CustomSchemaMetadata` interface.
  export interface CustomSchemaMetadata {
    placeholderText?: string
    tooltipText?: string
    // …
  }
}

src/schema.ts Outdated Show resolved Hide resolved
src/schema.ts Show resolved Hide resolved
@jquense jquense merged commit e593f8f into jquense:master Jun 15, 2023
1 check passed
@jquense
Copy link
Owner

jquense commented Jun 15, 2023

thanks!

@shaungrady shaungrady deleted the improve-metadata-typing branch June 15, 2023 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow meta's type to be extended
2 participants