Skip to content

Cannot use nominal/brand types in props #13444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Trinovantes opened this issue Jun 7, 2025 · 0 comments · May be fixed by #13452
Open

Cannot use nominal/brand types in props #13444

Trinovantes opened this issue Jun 7, 2025 · 0 comments · May be fixed by #13452
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler scope: sfc

Comments

@Trinovantes
Copy link

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

@edison1105 edison1105 added the 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. label Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. scope: compiler scope: sfc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants