vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.41k stars 8.3k forks source link

If defineProps's type uses vue's `Component` it will result in an incorrect type after compilation #9728

Closed Dunqing closed 11 months ago

Dunqing commented 11 months ago

Vue version

latest

Link to minimal reproduction

https://play.vuejs.org/#__DEV__eNp9kU1PwzAMhv+KlctAmjah3UYpArQDHGCCHXOpWrfLSJ0oSbeiqv8dp9U+DrCb7fd1/NjpxJO1s32DYikSnztlA3gMjQWdUfUgRfBSpJJUbY0L0MGL4YiQAvRQOlPDhJsnkgosFeHaGeuTThJk/nF5Nt9L6tObW0nJfBzCT3ISsLY6C8gZQLK9Szc/FuHgDFXJnNPov/CIKePkhkpVzXbeEDPHUSBFzoOURvdhgzLEyEsYlKhlWpvD21ALrsHpsZ5vMf/+o77zbaxJsXbo0e1RipMWMldhGOXV1zu2HJ/E2hSNZvcV8RO90U1kHG3PDRWMfeEbaF+HayuqNn7VBiR/XCqCRmc/+KXg28cb/7f6GXcxWwx9/A+i/wXqeKcQ

Steps to reproduce

Look at the js panel, you can see the as prop's type is null

What is expected?

The type is correct or the prop contains skipCheck: true

What is actually happening?

type is null

System Info

No response

Any additional comments?

For more info refer https://github.com/radix-vue/shadcn-vue/issues/187

pikax commented 11 months ago

Looks to be right to me, because component can be many things, the generated runtime type is null, that's expected and intended.

The type is correct or the prop contains skipCheck: true Not sure what you mean by this, where would skipCheck come from?

Dunqing commented 11 months ago

Not sure what you mean by this, where would skipCheck come from?

You can see https://play.vuejs.org/#__DEV__eNp9kU1PAjEQhv/KpJeFhEAMN1zWqOGgByXKsZd1GZZid9r0g4/g/nenS0AO6m1m3nfSZ/oexb21w21EMRG5r5yyATyGaEGXVE+lCF6KQpJqrHEBjvBouCKkAC2snGkg4+VM0hJXinDujPX5URKU/m5yZf4CH5yimguKzQc6Lnq9PkwLyEo6ZP1bSW3R60vKRycMfpSbgI3VZUDuAPL1TbE4WISdM1TnI26T/8ojBgxcGVqperjxhviqBANSVIyiNLpXG5QhPmoCnZK0Umuze+5mwUUcnOfVGqvPX+Ybv08zKeYOPbotSnHRQulqDCd59v6Ce64vYmOWUbP7H/ENvdExMZ5sD5GWjH3l62ifujz4Qxd+tg9I/nxUAk3OtvNLwemkFP46/Qd3PBx3e5yDaL8Bk/2xVw==

pikax commented 11 months ago

Sorry I still don't understand what's the issue, null should not have any check done.

Dunqing commented 11 months ago

Sorry I still don't understand what's the issue, null should not have any check done.

Thank you I understand. At first I thought the null type was incorrect. cc @zernonia

pikax commented 11 months ago

Just to confirm, here's an example of null without any warning or error

playground