все!
Я надеюсь, что ваша помощь ...!
Я создал проект React с CRA, * 1005 *
Бэкэнд - это GraphQl + узел на порту 3000.
Он отлично работает "http://localhost: 5000 "
Также отлично работает скрипт 'precodegen', поэтому сгенерированная схема. json в клиенте.
Однако, в команде codegen возникает следующая ошибка.
Помогите, пожалуйста ...! Спасибо ~!
пакет. json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"precodegen": "apollo-codegen introspect-schema http://localhost:5000/graphql --output schema.json",
"codegen": "apollo-codegen generate './src/**/!(*.local).ts' --addTypename --schema schema.json --target typescript --output ./src/__generated__/api.d.ts"
},
TERMINAL ERROR
yarn codegen
yarn run v1.17.3
$ apollo-codegen introspect-schema http://localhost:5000/graphql --output schema.json
$ apollo-codegen generate './src/**/!(*.local).ts' --addTypename --schema schema.json --target typescript --output ./src/__generated__/api.d.ts
TypeError: Property name expected type of string but got null
at validate (/Users/jongseoklee/dev/ts-graphql/client/node_modules/@babel/types/lib/definitions/utils.js:159:13)
at Object.validate (/Users/jongseoklee/dev/ts-graphql/client/node_modules/@babel/types/lib/definitions/utils.js:196:7)
at validateField (/Users/jongseoklee/dev/ts-graphql/client/node_modules/@babel/types/lib/validators/validate.js:24:9)
at validate (/Users/jongseoklee/dev/ts-graphql/client/node_modules/@babel/types/lib/validators/validate.js:17:3)
at builder (/Users/jongseoklee/dev/ts-graphql/client/node_modules/@babel/types/lib/builders/builder.js:38:27)
at Object.Identifier (/Users/jongseoklee/dev/ts-graphql/client/node_modules/@babel/types/lib/builders/generated/index.js:334:31)
at nonNullableTypeFromGraphQLType (/Users/jongseoklee/dev/ts-graphql/client/node_modules/apollo-codegen-typescript/src/helpers.ts:47:34)
at TypescriptAPIGenerator.typeFromGraphQLType (/Users/jongseoklee/dev/ts-graphql/client/node_modules/apollo-codegen-typescript/src/helpers.ts:55:20)
at TypescriptAPIGenerator.handleFieldValue (/Users/jongseoklee/dev/ts-graphql/client/node_modules/apollo-codegen-typescript/src/codeGeneration.ts:428:20)
at /Users/jongseoklee/dev/ts-graphql/client/node_modules/apollo-codegen-typescript/src/codeGeneration.ts:347:20
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.