Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Component type checking does not work out of box #373

Closed
Bobakanoosh opened this issue Jun 13, 2022 · 2 comments
Closed

Component type checking does not work out of box #373

Bobakanoosh opened this issue Jun 13, 2022 · 2 comments

Comments

@Bobakanoosh
Copy link

Bobakanoosh commented Jun 13, 2022

Describe the bug/issue

After fresh cloning this template, the type checking for components does not work.

To reproduce:

  1. Clone project
  2. Install using pnpm
  3. Use Typescript Vue Plugin (Volar) and Vue Language Features (Volar)
  4. Add <Counter :initial="{ a: 5 }" /> to App.vue

Counter.vue has a prop initial of type number. Here I am passing an object, { a: 5}, but do not get any warning from the editor.

image
As seen in the above image, the editor still recognizes the types of the component.

I'm making this issue in this template because if I create a fresh vue project via pnpm create vue@latest, the type checking works.

@Bobakanoosh
Copy link
Author

After a lot of testing I've found that the html.d.ts is causing this issue:

declare module '@vue/runtime-core' {
  interface AllowedComponentProps {
    [key: string]: any
  }
}
export {}

I assume this was added for UnoCSS attributify, but people using this template may not realize the side effects this can cause.

@antfu
Copy link
Member

antfu commented Jun 13, 2022

As vuejs/language-tools#1077 (comment) you can now remove html.d.ts safely.

@antfu antfu closed this as completed Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants