diff --git a/examples/loader.ts b/examples/loader.ts index 58feccb..788d12d 100644 --- a/examples/loader.ts +++ b/examples/loader.ts @@ -33,12 +33,12 @@ const resolvers: resolverTypes = { }, Dog: { owner: { - load (queries) { - return queries.map(q => new Promise(resolve => { + load(queries) { + return new Promise(resolve => { setTimeout(() => { - resolve(owners[q.parent.name]) + resolve(queries.map(q => owners[q.parent.name])) }, 1000) - })) + }) } } } diff --git a/package.json b/package.json index 74fd613..fd6acee 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "docs:preview": "vitepress preview", "build": "tsc -p tsconfig.json", "postbuild": "typedoc --readme none --entryDocument index.md --plugin typedoc-plugin-markdown --tsconfig tsconfig.json --hideInPageTOC true --out www/api src/index.ts", + "ts:check": "tsc -p tsconfig.test.json", "test": "ts-node examples/relay.ts" }, "devDependencies": { diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 0000000..eff2ba2 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "noEmit": true, + "skipLibCheck": true, + }, + "include": ["src/**/*.ts", "examples/**/*.ts"], +} diff --git a/www/docs/guide/loaders.md b/www/docs/guide/loaders.md index bbaa1de..9083ae0 100644 --- a/www/docs/guide/loaders.md +++ b/www/docs/guide/loaders.md @@ -57,13 +57,13 @@ const resolvers: resolverTypes = { }, Dog: { owner: { - load (queries) { + load(queries) { // Promise with timeout added to demonstrate caching - return queries.map(q => new Promise(resolve => { + return new Promise(resolve => { setTimeout(() => { - resolve(owners[q.parent.name]) + resolve(queries.map(q => owners[q.parent.name])) }, 1000) - })) + }) } } }