[compiler] The TS code compiled from setup-script has a type error about `@vue/shared` in pnpm
Vue version
3.2.40
Link to minimal reproduction
https://github.com/qmhc/vue-ts-test
Steps to reproduce
Run:
pnpm i
pnpm run build
# optional
pnpm run tsc
Then check src/index.ts
.
What is expected?
No error occurred.
What is actually happening?
It gets a type error following:
System Info
System:
OS: Windows 10 10.0.19044
CPU: (6) x64 AMD Ryzen 5 3500X 6-Core Processor
Memory: 14.79 GB / 31.93 GB
Binaries:
Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 105.0.5195.127
Edge: Spartan (44.19041.1266.0), Chromium (105.0.1343.50)
Internet Explorer: 11.0.19041.1566
npmPackages:
vue: ^3.2.40 => 3.2.40
Any additional comments?
After we comment the prop
in __returned__
, the error will disappear:
See https://github.com/microsoft/TypeScript/issues/42873
Not really an issue that Vue can fix, since we do have correct dependency relationships between the packages.
But if you are trying to emit types for your Vue components, you should use vue-tsc instead (this is what powers Volar internally)