我采取这些步骤,这意味着,我首先创建 json:
apollo-codegen introspect-schema schema.graphqls --output schema.json
产生:
{
"data": {
"__schema": {
"queryType": {
"name": "Query"
},
"mutationType": null,
"subscriptionType": null,
"types": [
{
"kind": "OBJECT",
"name": "Query",
"description": "",
"fields": [
{
...
但是之后,当我运行时:
apollo-codegen generate **/*.graphqls --schema schema.json --target typescript --output schema.ts
我得到一个空的schema.ts
类型文件:
/* tslint:disable */
// This file was automatically generated and should not be edited.
/* tslint:enable */
想法?