Skip to content

Commit 45f35d4

Browse files
authored
Merge pull request #88 from lorefnon/bugfix-batch-loader-types
Update examples and docs for loader type change
2 parents 8523553 + 0ae91f8 commit 45f35d4

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

examples/loader.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ const resolvers: resolverTypes = {
3333
},
3434
Dog: {
3535
owner: {
36-
load (queries) {
37-
return queries.map(q => new Promise(resolve => {
36+
load(queries) {
37+
return new Promise(resolve => {
3838
setTimeout(() => {
39-
resolve(owners[q.parent.name])
39+
resolve(queries.map(q => owners[q.parent.name]))
4040
}, 1000)
41-
}))
41+
})
4242
}
4343
}
4444
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"docs:preview": "vitepress preview",
1515
"build": "tsc -p tsconfig.json",
1616
"postbuild": "typedoc --readme none --entryDocument index.md --plugin typedoc-plugin-markdown --tsconfig tsconfig.json --hideInPageTOC true --out www/api src/index.ts",
17+
"ts:check": "tsc -p tsconfig.test.json",
1718
"test": "ts-node examples/relay.ts"
1819
},
1920
"devDependencies": {

tsconfig.test.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"noEmit": true,
5+
"skipLibCheck": true,
6+
},
7+
"include": ["src/**/*.ts", "examples/**/*.ts"],
8+
}

www/docs/guide/loaders.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ const resolvers: resolverTypes = {
5757
},
5858
Dog: {
5959
owner: {
60-
load (queries) {
60+
load(queries) {
6161
// Promise with timeout added to demonstrate caching
62-
return queries.map(q => new Promise(resolve => {
62+
return new Promise(resolve => {
6363
setTimeout(() => {
64-
resolve(owners[q.parent.name])
64+
resolve(queries.map(q => owners[q.parent.name]))
6565
}, 1000)
66-
}))
66+
})
6767
}
6868
}
6969
}

0 commit comments

Comments
 (0)