-
Notifications
You must be signed in to change notification settings - Fork 49
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
IDE type issues with $device helper #136
Comments
Unless Webstorm is changing something under the hood, I can't see why I would also fail
Implementation
|
No, that shouldn't happen. Would you provide a reproduction? |
Sure can! Here is the sandbox: https://codesandbox.io/p/sandbox/great-bash-7zdlg1 Issue persist when running |
That's a bug with this module (or rather, in the build system), as it does not generate types for its plugin: https://unpkg.com/browse/@nuxtjs/device@3.1.0/dist/runtime/plugin.d.ts. |
Yeah, I get a similar error in VSCode: |
I came across the same issue, I shimmed it by doing:
|
I get a similar error in VSCode: '__VLS_ctx.$device' is of type 'unknown'. |
I solved the problem for myself like this // plugins.d.ts
import type { Device } from "@nuxtjs/device/runtime/types";
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
$device: Device;
}
} |
That helped, but would be nice to have it out of the box in library |
Webstorm is unable to locate the types for the $device helper. Not really familiar with Nuxt plugins/modules so unfortunately I'm not able to locate the issue. App fails nuxi typecheck as well but is able to be built and functions as expected. Tried adding the module to my tsconfig with no fix.
Nuxt: v3.2.2
device: v3.1.0
The text was updated successfully, but these errors were encountered: