通过graphql-tag / loader导入多个graphql查询的类型

我有一个组件,可通过webpack的graphql-tag / loader从graphql文件导入查询。

query testQuery {
  test
}

query test2Query {
   test
}
import { testQuery,test2Query } from './test.graphql'

我现在正在尝试为所有可能的查询和变异声明一个通用类型:

declare module '*.graphql' {
  import { DocumentNode } from 'graphql';
  const exp: { [key: string]: DocumentNode };

  export default exp;
}

打字稿编译器无法识别我的导入。我知道我的输入定义有误,尽管在这种情况下我似乎找不到能帮助我的文档。

有什么建议吗?

iCMS 回答:通过graphql-tag / loader导入多个graphql查询的类型

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2144584.html

大家都在问