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: branding, implement standard-schema #1178

Merged
merged 51 commits into from
Oct 16, 2024
Merged

feat: branding, implement standard-schema #1178

merged 51 commits into from
Oct 16, 2024

Conversation

ssalbdivad
Copy link
Member

@ssalbdivad ssalbdivad commented Oct 16, 2024

This PR adds branding via the following chained API:

const t = type("string").brand("foo")

And the following native syntax:

const t = type("number#cool")

It also allows transforming between branded and associated versions of a given type, which determines whether attributes that don't exist in TS are preserved when inferring output:

const unbranded = type({
    age: "number.integer >= 0"
})

const branded = unbranded.brandAttributes()

const reunbranded = branded.unbrandAttributes()

It also adds support for Standard Schema v1.

@ssalbdivad ssalbdivad merged commit bfbb7ad into main Oct 16, 2024
6 checks passed
@ssalbdivad ssalbdivad deleted the rc16 branch October 16, 2024 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done (merged or closed)
Development

Successfully merging this pull request may close these issues.

1 participant