-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Cannot use nominal/brand types in props #13444
Copy link
Copy link
Closed
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.regressionscope: compilerscope: sfc
Metadata
Metadata
Assignees
Labels
🔨 p3-minor-bugPriority 3: this fixes a bug, but is an edge case that only affects very specific usage.Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.regressionscope: compilerscope: sfc
Type
Fields
Give feedbackNo fields configured for issues without a type.
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 tabSwitching between 3.5.14 and 3.5.15 show the type of
userIdprop change fromnulltoObjectWhat is expected?
No type errors
What is actually happening?
The nominal type is treated as
Objectinstead of a string primitiveSystem 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