nuxt-modules / device

Nuxt module for detecting device type.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Types are missing in Nuxt3 plugin

TheDutchCoder opened this issue · comments

I'm having issues getting types to work with this Nuxt 3 module and plugins.
Whenever $device is accessed from nuxtApp, there are no types defined.

Plugins allow you to extend the $device object, but because it's missing types, the custom extensions are marked as Property 'isInAppBrowser' does not exist on type 'Device'.ts(2339)

Same here, solved by manually overriding the $device instance property in the types/index.d.ts

import { ComponentCustomProperties } from 'vue'
import { Device } from '@nuxtjs/device'

declare module '@vue/runtime-core' {
  interface ComponentCustomProperties {
    $device: Device
  }
}