Skip to content

[Bug Report][4.0.1] TypeScript error when using custom validation rules #22688

@pkalita-lbl

Description

@pkalita-lbl

Environment

Vuetify Version: 4.0.1
Vue Version: 3.5.29
OS: macOS 10.15.7 (current)

Steps to reproduce

  1. View the TypeScript error generated by line 13 of App.vue

Expected Behavior

No TypeScript errors

Actual Behavior

This typescript error:

Expected 1-2 arguments, but got 0. ts-plugin(2554)
rules.d.ts(5, 52): An argument for 'err' was not provided.
Image

Reproduction Link

https://codesandbox.io/p/devbox/j6xncq

Other comments

Apologies for providing a codesandbox link instead of a Vuetify Playground link, but I couldn't see how to add the Rules plugin in the Playground. The codesandbox example is essentially straight out of the Validation rules doc page (https://vuetifyjs.com/en/features/rules).

I'm having trouble reproducing it in the codesandbox, but in my actual project I also see this TypeScript error from the same use of a custom rule in a template:

error TS2722: Cannot invoke an object which is possibly 'undefined'.

72             :rules="[rules.pinCode()]"
                        ~~~~~~~~~~~~~

Metadata

Metadata

Assignees

Labels

E: rulesT: bugFunctionality that does not work as intended/expectedlabsMust be completed for this component to leave labs

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions