Description
Vue version
3.3.4
Link to minimal reproduction
Steps to reproduce
Steps to reproduce the bug from scratch (repro already has this covered):
- Pass a symbol as a prop value to a component that expects another type.
- Observe a runtime error since symbols can't be converted to string or number.
What is expected?
A classic warning about type mismatch, e.g. Invalid prop: type check failed for prop "propName". Expected String, got Symbol
What is actually happening?
A runtime error because getInvalidTypeMessage
function is trying to convert the symbol to a string/number.
System Info
System:
OS: macOS 12.4
CPU: (10) arm64 Apple M1 Pro
Memory: 92.69 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
Browsers:
Chrome: 114.0.5735.90
Firefox: 112.0.2
Safari: 15.5
npmPackages:
vue: ^3.3.4 => 3.3.4
Any additional comments?
The fix could be pretty straightforward: check if we have a symbol
in styleValue
function and do not convert a value to anything else since it won't be useful anyway.
I'm going to submit a PR that fixes this issue.