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

Add global keywords config option #1280

Open
ssalbdivad opened this issue Jan 28, 2025 · 0 comments
Open

Add global keywords config option #1280

ssalbdivad opened this issue Jan 28, 2025 · 0 comments

Comments

@ssalbdivad
Copy link
Member

ssalbdivad commented Jan 28, 2025

Could be used like:

import { configure } from "arktype/config"

configure({
    keywords: {
       "string.email": { message: () => "INVALID EMAIL" }
    }
})

As opposed to:

import { keywords, scope } from "arktype"

const { type } = scope({
    string: scope({
        ...keywords.string,
        email: keywords.string.email.configure({
            message: () => "INVALID EMAIL"
        })
    }).export()
})

// INVALID EMAIL
type("string.email")("foo").toString() //?
@github-project-automation github-project-automation bot moved this to To do in arktypeio Jan 28, 2025
@ssalbdivad ssalbdivad moved this from To do to In progress in arktypeio Jan 28, 2025
@ssalbdivad ssalbdivad moved this from In progress to Backlog in arktypeio Jan 29, 2025
@ssalbdivad ssalbdivad moved this from Backlog to In progress in arktypeio Jan 29, 2025
@ssalbdivad ssalbdivad moved this from In progress to Planned in arktypeio Jan 29, 2025
@ssalbdivad ssalbdivad moved this from Planned to In progress in arktypeio Jan 29, 2025
@ssalbdivad ssalbdivad moved this from In progress to Implemented in arktypeio Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Implemented
Development

No branches or pull requests

1 participant