From ccb42b0ed5136dc5554ed65cca2ed49d50cc09be Mon Sep 17 00:00:00 2001 From: Soichi Takamura Date: Tue, 25 Feb 2020 15:44:09 +0900 Subject: [PATCH] Update example "with-typescript-graphql" (#10637) * add peerDeps of graphql-let * ncu -u && typesync * Use resolver types for resolver implementation --- examples/with-typescript-graphql/.gitignore | 2 ++ .../with-typescript-graphql/.graphql-let.yml | 1 + .../with-typescript-graphql/lib/resolvers.ts | 12 +++++------ examples/with-typescript-graphql/package.json | 20 +++++++++++-------- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/examples/with-typescript-graphql/.gitignore b/examples/with-typescript-graphql/.gitignore index 764f8b2387..2433e795cd 100644 --- a/examples/with-typescript-graphql/.gitignore +++ b/examples/with-typescript-graphql/.gitignore @@ -1 +1,3 @@ +.next +node_modules __generated__ diff --git a/examples/with-typescript-graphql/.graphql-let.yml b/examples/with-typescript-graphql/.graphql-let.yml index 12ab765d57..a2b012ff88 100644 --- a/examples/with-typescript-graphql/.graphql-let.yml +++ b/examples/with-typescript-graphql/.graphql-let.yml @@ -5,3 +5,4 @@ plugins: - typescript - typescript-operations - typescript-react-apollo +respectGitIgnore: true diff --git a/examples/with-typescript-graphql/lib/resolvers.ts b/examples/with-typescript-graphql/lib/resolvers.ts index 1bd9511549..59cdf0e908 100644 --- a/examples/with-typescript-graphql/lib/resolvers.ts +++ b/examples/with-typescript-graphql/lib/resolvers.ts @@ -1,11 +1,9 @@ -import { IResolvers } from 'apollo-server-micro' +import { QueryResolvers } from './type-defs.graphqls' -const resolvers: IResolvers = { - Query: { - viewer(_parent, _args, _context, _info) { - return { id: 1, name: 'John Smith', status: 'cached' } - }, +const Query: Required = { + viewer(_parent, _args, _context, _info) { + return { id: String(1), name: 'John Smith', status: 'cached' } }, } -export default resolvers +export default { Query } diff --git a/examples/with-typescript-graphql/package.json b/examples/with-typescript-graphql/package.json index 17a3e19e3c..7d76a6b06a 100644 --- a/examples/with-typescript-graphql/package.json +++ b/examples/with-typescript-graphql/package.json @@ -18,20 +18,24 @@ "apollo-client": "2.6.8", "apollo-link-http": "1.5.16", "apollo-link-schema": "1.2.4", - "apollo-server-micro": "2.9.14", + "apollo-server-micro": "2.10.1", "apollo-utilities": "^1.3.3", - "graphql": "^14.5.8", - "graphql-tag": "^2.10.1", + "graphql": "^14.6.0", + "graphql-tag": "^2.10.3", "next": "latest", "react": "^16.12.0", "react-dom": "^16.12.0" }, "devDependencies": { - "@graphql-codegen/typescript": "^1.9.1", - "@graphql-codegen/typescript-operations": "^1.9.1", - "@graphql-codegen/typescript-react-apollo": "^1.9.1", - "@types/react": "^16.9.17", + "@graphql-codegen/cli": "1.12.2", + "@graphql-codegen/plugin-helpers": "1.12.2", + "@graphql-codegen/typescript": "^1.12.2", + "@graphql-codegen/typescript-operations": "^1.12.2", + "@graphql-codegen/typescript-react-apollo": "^1.12.2", + "@graphql-codegen/typescript-resolvers": "1.12.2", + "@types/react": "^16.9.22", + "@types/react-dom": "^16.9.5", "graphql-let": "0.x", - "typescript": "^3.7.4" + "typescript": "^3.8.2" } }