问题描述
我正在构建带有amplify的React + aws AppSync graphql Web应用程序。一直在享受这个出色的工具,但是无法像我期望的那样使codegen
正常工作-它不会为TypeScript前端生成基本类型。
说我将此schema.graphql
文件提供给amplify codegen
:
type Event @model {
id: ID!
name: String
effects: [EventEffects]
}
type EventEffect {
name: String
delta: Int
}
与此config.yml
:
projects:
myapi:
schemaPath: amplify/backend/api/myapi/build/schema.graphql
includes:
- src/graphql/**/*.ts
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: typescript
generatedFileName: src/API.ts
docsFilePath: src/graphql
extensions:
amplify:
version: 3
然后,代码生成器给了我API.ts
和queries.ts
,mutations.ts
,subscriptions.ts
和schema.json
。问题是,没有生成基本类型。
我可以通过以下方式获取Event的接口:
export interface Event
extends Omit<Exclude<GetEventQuery["getEvent"],null>,"__typename"> {}
但是由于我没有添加EventEffect
指令,所以无法获得@modal
的接口。
要缩小我的问题范围:
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)