When props use generics and are simultaneously used with withDefaults, toRefs cannot correctly infer their types
Vue version
3.3.10
Link to minimal reproduction
Steps to reproduce
- Define a prop using generics, and then specify another prop using a non-generic definition.
- Use
toRefs
to resolve the props - Use resolved prop attach to nested component
What is expected?
The type is correct.
What is actually happening?
The type is incorrect.
System Info
System:
OS: macOS 14.1.2
CPU: (10) x64 Apple M2 Pro
Memory: 303.87 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.21 - ~/Library/pnpm/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
pnpm: 8.11.0 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 120.0.6099.62
Safari: 17.1.2
npmPackages:
vue: ^3.3.10 => 3.3.10
Any additional comments?
No response
I meet the same problem.
- the type turns any when using toRefs
- the type is incorrect in template
vue:3.3.10