8000 Props are not inferred when using `fallthroughAttributes` and multiple root nodes · Issue #5452 · vuejs/language-tools · GitHub
[go: up one dir, main page]

Skip to content
Props are not inferred when using fallthroughAttributes and multiple root nodes #5452
Closed
@MikeBellika

Description

@MikeBellika

Vue - Official extension or vue-tsc version

vue-tsc 2.2.10

VSCode version

N/A

Vue version

3.5.17

TypeScript version

5.8.0

System Info

System:
    OS: macOS 15.5
    CPU: (10) arm64 Apple M4
    Memory: 336.75 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.10.0 - ~/.nvm/versions/node/v22.10.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v22.10.0/bin/yarn
    npm: 10.9.0 - ~/.nvm/versions/node/v22.10.0/bin/npm
    pnpm: 9.15.4 - ~/.nvm/versions/node/v22.10.0/bin/pnpm
    bun: 1.2.15 - ~/.bun/bin/bun

package.json dependencies

"dependencies": {
    "vue": "^3.5.17"
  },
  "devDependencies": {
    "@tsconfig/node22": "^22.0.2",
    "@types/node": "^22.15.32",
    "@vitejs/plugin-vue": "^6.0.0",
    "@vue/tsconfig": "^0.7.0",
    "npm-run-all2": "^8.0.4",
    "typescript": "~5.8.0",
    "vite": "^7.0.0",
    "vite-plugin-vue-devtools": "^7.7.7",
    "vue-tsc": "^2.2.10"
  }

Steps to reproduce

  1. Clone https://github.com/MikeBellika/fallthrough-type-error
  2. Install dependencies with pnpm install
  3. Run pnpm type-check

What is expected?

There should be no type errors in the reproduction repo, as MyComponent defines the prop status.

What is actually happening?

The type $props type of MyComponent is inferred as

Partial<{}> & Omit<{} & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>

This causes a type error in App.vue, since it's using the status prop.

Link to minimal reproduction

https://github.com/MikeBellika/fallthrough-type-error

Any additional comments?

This only happens when:

  1. The component with props (MyComponent.vue) has multiple root nodes AND
  2. The component does not use defineModel or defineEmits. Notice that there are no issues with MyComponentWithModel

No type error with vue 3.5.10, seems like it started in 3.5.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first🔩 p2-edge-case

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0