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

Missing component type definition #336

Closed
tbontb-iaq opened this issue Jul 13, 2024 · 5 comments
Closed

Missing component type definition #336

tbontb-iaq opened this issue Jul 13, 2024 · 5 comments

Comments

@tbontb-iaq
Copy link

Problem

VSCode cannot obtain component type information.

Steps to reproduce

  1. Create a new project using pnpm create vuetify command
  2. Choose "Recommended" preset, use Typescript and use pnpm
  3. Install dependencies and use VSCode to open project

image

Run the pnpm run dev command and open the page in a browser to ensure that vite generates the corresponding type files.

Hover the mouse over the vuetify component and you can see that vscode cannot correctly identify their types.

image

Some information that may be useful

VSCode version: 1.91.1

Vue.volar: v2.0.26

@tbontb-iaq
Copy link
Author

I found the complete type definitions in node_modules/vuetify/lib/index.d.mts, but I didn't know how to use them. I copied them into vite-env.d.ts and it worked fine.

image

@TianYa-Q
Copy link

You could do this

// vuetifyType.d.ts
declare module "vuetify/lib/framework" {
  import Vuetify from "vuetify";
  export default Vuetify;
}

@tbontb-iaq
Copy link
Author

tbontb-iaq commented Aug 18, 2024

Thanks for your help. In fact they have fixed this in v3.6.13.

@KaelWD
Copy link
Member

KaelWD commented Aug 19, 2024

@tbontb-iaq please try the latest nightly build, we've changed this again: vuetifyjs/vuetify@7c8aeef
https://vuetifyjs.com/en/getting-started/installation/#nightly-builds

@tbontb-iaq
Copy link
Author

No problems encountered. Test steps:

  1. Create project with pn create vuetify
  2. Install nightly with pn i vuetify@npm:@vuetify/nightly@latest and installed @vuetify/nightly 3.7.0-master.2024-08-17
  3. Open the project with vscode, view HelloWorld component, and hover the mouse over the vuetify component to view the type definition

image

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

3 participants