[Vuejs]-Typescript keeps showing warning cannot find module xxx?

0๐Ÿ‘

โœ…

I partially found an answer by adding a type define to nuxt

tsconfig.json

    {
  // https://nuxt.com/docs/guide/concepts/typescript
  "extends": "./.nuxt/tsconfig.json",
  "files": ["./types/graphql.d.ts"]
}

graphql.d.ts

declare module '*.gql' {
    import { DocumentNode } from 'graphql'
    const Schema: DocumentNode
  
    export = Schema
  }

Leave a comment