2021年3月6日星期六

Trying to import gql files error 2307 in react native with typescript

In the code, import shows the error "Cannot find module './somefile.gql' or its corresponding type declarations.ts(2307)", but I can actually run the app in a device

Problem comes as I want to commit and husky (pre commit hook) catch the error and can't deploy the code

Update: Already have plugin "babel-plugin-import-graphql" in .babelrc, I guess thats why it builds fine, husky runs tsc and so catch the error

import {    getWorkspaces as GET_WORKSPACES,    getCurrentWorkspace as GET_WORKSPACE,  } from '../../graphql/queries/workspaces.gql';  

error says

Cannot find module '../../graphql/queries/workspaces.gql' or its corresponding type declarations.ts(2307)  
https://stackoverflow.com/questions/66511168/trying-to-import-gql-files-error-2307-in-react-native-with-typescript March 07, 2021 at 06:13AM

没有评论:

发表评论