typescript - 尝试在使用打字稿做出本机反应时导入 gql 文件错误 2307
问题描述
在代码中,导入显示错误“找不到模块'./somefile.gql'或其相应的类型声明.ts(2307)”,但我实际上可以在设备中运行该应用程序
问题来了,因为我想提交并且 husky(预提交挂钩)捕获错误并且无法部署代码
更新:.babelrc 中已经有插件“babel-plugin-import-graphql”,我想这就是它构建良好的原因,husky 运行 tsc 并因此捕获错误
import {
getWorkspaces as GET_WORKSPACES,
getCurrentWorkspace as GET_WORKSPACE,
} from '../../graphql/queries/workspaces.gql';
错误说
Cannot find module '../../graphql/queries/workspaces.gql' or its corresponding type declarations.ts(2307)
解决方案
推荐阅读
- react-native - 在反应原生博览会中上传二进制图像
- django - 如何在 Django 中将数字转换为月份名称?
- reactjs - 从 DynamoDB 表中获取数据并将其显示在 React 应用程序中
- php - 循环请求数据库与查找
- python - 如何在 Python 中创建真正可调用的数组或矩阵
- python-3.x - 如何管理python中两个范围之间的值?
- android - Android Studio - Gradle 实现 (...) { exclude ... } 不起作用(无法从依赖项中排除组)
- unix - 将 teradata 结果导出到文件会添加空格
- java - 如何使用 Stream 对两个列表进行配对
- python - Django 的 AWS Elastic Beanstalk 500 内部服务器错误