dwightjack / vue-types

Vue Prop Types definitions
https://dwightjack.github.io/vue-types/
MIT License
572 stars 35 forks source link

Hello, why does undefineProps return unknown when defined? #449

Open Evllis opened 8 months ago

Evllis commented 8 months ago

Library version

image

Vue.js version

image

Question

20240110_172008

20240110_171957

20240110_171936

20240110_171914

20240110_171856

I searched on Google for a long time but couldn't find a solution to the problem

Looking at the code prompt, the methods all return results, but when declaring variables, the properties are all unknown. I don't know why Can you help me, thank you.

20240110_172905

But when I use the original notation, I can access the target type, but I don't want to do this because compared to your plugin, this notation is too cumbersome

dwightjack commented 8 months ago

Hello, I tried to create a reproduction demo here: https://github.com/dwightjack/vitejs-vite-pktjcl. When I open the HelloWorld.vue component in VSCode I see the correct type:

image

Could you try to download it, install it (npm ci), and let me know if you see the correct typing as well?

Evllis commented 8 months ago

Okay, thank you. I'll give it a try and let you know once I have the results.

Evllis commented 8 months ago

image

I just downloaded your demo and installed it, and I have correctly displayed the type here.

It seems that there is an issue with the configuration of my project, which affects the correct derivation of vue types.

Let me find out where the problem is.

Anyway, thank you for your help, thank you very much.

hls-1992 commented 5 months ago

I have the same question I think it was caused by the TS option 'strictNullChecks: false' when I delete this row and restart vscode,the question is missing