Skip to content

Built-in v-model modifiers produce type errors with v3.1.2 #4166

@Anton-Plagemann

Description

@Anton-Plagemann

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

v3.1.2

Reproduction

https://codesandbox.io/p/devbox/sharp-christian-kzdxt9?file=%2Fapp%2Fpages%2Findex.vue

Description

Starting from v3.1.2, using the built-in v-model-modifiers produces type errors. They are still working tho, so its only a type issue.

Reproduction:

  1. Open provided link
  2. Run pnpx nuxi typecheck

Additional context

No response

Logs

➜  workspace git:(master) ✗ pnpx nuxi typecheck
Packages: +1
+
Progress: resolved 1, reused 1, downloaded 0, added 1, done
ℹ Nuxt Icon server bundle mode is set to local                                                                                                                                                        11:09:23 AM
✔ Nuxt Icon discovered local-installed 2 collections: lucide, simple-icons                                                                                                                            11:09:25 AM
ℹ Running with compatibility version 4                                                                                                                                                           nuxt 11:09:25 AM
app/pages/index.vue:8:22 - error TS2353: Object literal may only specify known properties, and 'modelModifiers' does not exist in type '{ readonly onBlur?: ((event: FocusEvent) => any) | undefined; readonly onChange?: ((event: Event) => any) | undefined; readonly "onUpdate:modelValue"?: ((payload: number) => any) | undefined; ... 24 more ...; modelValue?: number | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps'.

8       <UInput v-model.number="myNumber" type="number" />
                       ~~~~~~~

app/pages/index.vue:9:22 - error TS2353: Object literal may only specify known properties, and 'modelModifiers' does not exist in type '{ readonly onBlur?: ((event: FocusEvent) => any) | undefined; readonly onChange?: ((event: Event) => any) | undefined; readonly "onUpdate:modelValue"?: ((payload: string) => any) | undefined; ... 24 more ...; modelValue?: string | undefined; } & VNodeProps & AllowedComponentProps & ComponentCustomProps'.

9       <UInput v-model.lazy="myText" />
                       ~~~~~


Found 2 errors in the same file, starting at: app/pages/index.vue:8


 ERROR  Process exited with non-zero status (2)                                                                                                                                                        11:09:41 AM

    at R._waitForOutput (/root/.cache/pnpm/v3/tmp/dlx-4483/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/main.mjs:508:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.run (/root/.cache/pnpm/v3/tmp/dlx-4483/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/typecheck.mjs:91:9)
    at async runCommand$1 (/root/.cache/pnpm/v3/tmp/dlx-4483/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.BlFGnQYG.mjs:1767:16)
    at async runCommand$1 (/root/.cache/pnpm/v3/tmp/dlx-4483/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.BlFGnQYG.mjs:1758:11)
    at async runMain$1 (/root/.cache/pnpm/v3/tmp/dlx-4483/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/shared/nuxi.BlFGnQYG.mjs:1896:7) 



 ERROR  Process exited with non-zero status (2)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingv3#1289

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions