如何使用GraphQL流类型
我很难在我的项目中使用GraphQL流类型 例如,我有一个类,它期望一个GraphQLSchema实例作为 构造函数参数。i、 e:如何使用GraphQL流类型,graphql,flowtype,graphql-js,Graphql,Flowtype,Graphql Js,我很难在我的项目中使用GraphQL流类型 例如,我有一个类,它期望一个GraphQLSchema实例作为 构造函数参数。i、 e: import type { GraphQLSchema } from 'graphql'; type MyGraphQLConfig = { schemaFiles: string, resolvers: Object, mocks: Object, enableMocks: boolean } class GraphQL { graphQ
import type { GraphQLSchema } from 'graphql';
type MyGraphQLConfig = {
schemaFiles: string,
resolvers: Object,
mocks: Object,
enableMocks: boolean
}
class GraphQL {
graphQLSchema: GraphQLSchema;
configs: MyGraphQLConfig;
constructor(configs: MyGraphQLConfig, graphQLSchema: GraphQLSchema) {
this.graphQLSchema = null;
this.configs = configs;
}
getSchema() : GraphQLSchema {
return this.graphQLSchema;
}
}
对此文件运行流检查命令时,出现以下错误:
4: import type { GraphQLSchema } from 'graphql';
^^^^^^^^^
graphql. Required module not found
但是,当查看文件夹节点_modules/graphql/I时,我可以看到其中的所有.flow文件
是否有我遗漏的内容?是否检查了.flowconfig以查看是否忽略了/node_modules/* 我可以通过删除忽略来解决此问题。然而,我确实遇到了其他问题 从.flowconfig中取消注释节点_模块成功!