Skip to content

Parent component's fallthrough attributes ignore child component's generic arguments (with fallthroughAttributes enabled) #5684

@GrantGryczan

Description

@GrantGryczan

Vue - Official extension or vue-tsc version

3.1.0

VSCode version

1.104.2

Vue version

3.5.22

TypeScript version

5.9.3

Steps to reproduce

  1. Visit the minimal reproduction linked below.
  2. In App.vue, hover over other-thing at line 6, col 13 to see its inferred type.

What is expected?

Because MyParent calls MyGenericChild with number passed to its generic parameter T (due to :thing="1"), the inferred attribute types on MyParent that fall through to MyGenericChild should assume number as the type for T, leading the other-thing prop to have type number.

What is actually happening?

Instead, other-thing's type is unknown, completely forgetting that MyParent passed any generic argument to MyGenericChild.

More broadly, the child component's attributes act as if the component was passed the widest possible types that each of its generic parameters extends.

Link to minimal reproduction

https://play.vuejs.org/#eNqNUt9LwzAQ/ldCnhS0RcUHZ52oiCioQ4tPAantrY22SUiuczL2v3tJ3eiYzr2E3He/vvvuZvzCmGjSAh/wxOVWGmQOsDWszlR5Jjg6wYdCycZoi+z+a5RZUMjGVjdM8CheIL6G4KdCJXFXhpLIQGhMnSGQxViyTNdYgd3HSoYeDi19BGcxhSVxL4fvEYFcq7Eso3enFbGc+UqC57oxsgb7aFBqRSQHLHi8L6tr/XkXMLQt7C3wvIL84xccM1sCeljw6+cHmNJ/6Wx00dY02gbnEzhdt55HF3bZqoKo9eICo9ugIU2auuspgnIL4p6Mj5yHeMFJyqsN442pGlZWt2V1gSTdW4uwPpQXNcf0R8vVPkLNSdn+6rZd/w0ooLpXlayL/hH08S1PYaXUYHELB3+cwXqLTZRZ2QWTmYYBChhLBSOrjUuCkKHfgKVEk3XnmHrkvIPmw53dfwYo5GSYxP5dJ/s6Aeu3SxSPouPo8NBj6F6W6HF0Eh3x+TeMcC+H

Any additional comments?

This issue sounds similar to #5535, but it is not at all the same. #5535 suggests that the parent component should implicitly have inferred generic parameters, which I disagree with. Here, the parent component should not be generic. It simply forwards the attributes of the child component with generics specified, and that specified instance of the generic child component is the child component receiving the fallthrough attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first🔨 p3-minor-bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions