Skip to content

Unable to pass native HTML element parameters when strictTemplates is true #4977

@rijenkii

Description

@rijenkii

Environment

  • Operating System: Linux
  • Node Version: v20.12.0
  • Nuxt Version: 4.1.2
  • CLI Version: 3.28.0
  • Nitro Version: 2.12.6
  • Package Manager: [email protected]
  • Builder: -
  • User Config: modules, devtools, compatibilityDate, future, css, typescript
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Is this bug related to Nuxt or Vue?

Nuxt

Package

v3.x

Version

v3.3.3

Reproduction

https://codesandbox.io/p/devbox/flamboyant-julien-6zwsvc

npx nuxt typecheck should be executed automatically.

Code for historical purposes

Relevant parts of Nuxt config:

export default defineNuxtConfig({
  typescript: {
    tsConfig: {
      vueCompilerOptions: {
        strictTemplates: true,
      },
    },
  },
});

Code:

<!-- pages/index.vue -->
<template>
  <div class="flex flex-col items-center justify-center gap-4 h-screen">
    <h1 class="font-bold text-2xl text-(--ui-primary)">
      Nuxt UI v3 - Playground
    </h1>

    <div class="flex items-center gap-2">
      <UInput model-value="Test value" readonly />
    </div>
  </div>
</template>

Description

Passing for example readonly parameter to UInput works at runtime and does not emit any type errors with strictTemplates turned off, but with it turned on it throws a type error, saying that readonly cannot be passed to UInput:

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

8       <UInput model-value="Test value" readonly />
                                         ~~~~~~~~

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingp3-lowMinor cosmetic, edge case, or documentation issuev3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions