Skip to content

Cannot use nominal/brand types in props #13444

Closed
@Trinovantes

Description

@Trinovantes

Vue version

3.5.15

Link to minimal reproduction

https://play.vuejs.org/#eNqlkl1v0zAUhv/KkS8ISMXd1E1IIa1E0SSGBEyscIMRypLTkuHYlu2UVlH+O8d2m04T7IY7+3y85zkfPXtjDN92yHJWuMo2xoMs1WYumHeCgUPfmYVQTWu09dDDF4f2uoYB1la3kPHp0paqzl6PIR/2b3VrRnf6hgqZUEJVWjkPXRKZQ3Z+dpZB6Q6yQhXTBEEl6eOxNbL0GH6+SFLhKXweJF42NXEmMcGCY0qRxfRBGptQH1R03Wz4vdOK2uyFAhCsIq1Gov1kfENQguUQPcFXSql/v482bzucHO3VT6x+/cV+73bBJtiNRaLZomCjz5d2gz65r24/4o7eo7PVdScp+gnnZ3RadoExhS07VRP2g7hIex2n36jNyl3tPCp3bCqAhsghxgtGmwhj/FfrJ9wZv4h5Qg00xdMe//NSTldgrDaOjqDGdaPwJvyKA0faaT6exbB4/uLJ43iHNATo++NpDYT9+BBife4dNZAA7oKBAG737Z2WoYJQuIv4fm8QYkKxmsByQVEreHYck8Wy1kru4VuU+J7Dkhgfpx8GMD/oOG9pPRPIkj1LUD+2aMOuCGrGL/n5RbB593W0XvJXfMaGP6MxOio=

Steps to reproduce

For some reason, the sfc playground always throws the error unless you're in MyComp.vue's JS tab

Image

Switching between 3.5.14 and 3.5.15 show the type of userId prop change from null to Object

What is expected?

No type errors

What is actually happening?

The nominal type is treated as Object instead of a string primitive

Invalid prop: type check failed for prop "userId". Expected Object, got String with value "100".
 at <MyCompuser-id="100">
 at <Repl>

System Info

Any additional comments?

I'm aware TypeScript does not actually have nominal types and this is just a hack to fake it but I think this is a common enough usage in large codebases that it should be accounted for

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions