We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Describe the bug
Using uri on the validation property rule will throw a types error saying it does not exist, when it does.
uri
validation
To Reproduce
Simply create an validation property in any TS file using uri:
defineField({ name: 'url', title: 'URL', description: 'Enter an external URL path', type: 'string', validation: (Rule) => Rule.required().uri({ scheme: ['http', 'https', 'mailto', 'tel'] }) })
This will throw a TS error: Property 'uri' does not exist on type 'StringRule'.ts(2339)
Property 'uri' does not exist on type 'StringRule'.ts(2339)
Expected behavior
uri is still valid, along with its corresponding message flag. It should be added to the StringRule types. The current StringRule types are here:
StringRule
export declare interface StringRule extends RuleDef<StringRule, string> { min: (minNumber: number | FieldReference) => StringRule max: (maxNumber: number | FieldReference) => StringRule length: (exactLength: number | FieldReference) => StringRule uppercase: () => StringRule lowercase: () => StringRule regex( pattern: RegExp, name: string, options: { name?: string invert?: boolean }, ): StringRule regex( pattern: RegExp, options: { name?: string invert?: boolean }, ): StringRule regex(pattern: RegExp, name: string): StringRule regex(pattern: RegExp): StringRule email(): StringRule }
Which versions of Sanity are you using?
sanity 3.71.2 (up to date)
What operating system are you using?
pnpm v9.15.4 node v22.12.0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
Using
uri
on thevalidation
property rule will throw a types error saying it does not exist, when it does.To Reproduce
Simply create an
validation
property in any TS file usinguri
:This will throw a TS error:
Property 'uri' does not exist on type 'StringRule'.ts(2339)
Expected behavior
uri
is still valid, along with its corresponding message flag. It should be added to theStringRule
types. The currentStringRule
types are here:Which versions of Sanity are you using?
sanity 3.71.2 (up to date)
What operating system are you using?
pnpm v9.15.4
node v22.12.0
The text was updated successfully, but these errors were encountered: