mirror of
https://github.com/vale981/apollo-server
synced 2025-03-05 09:41:40 -05:00
Update to TypeScript 3.1
This commit is contained in:
parent
0ebf8900a0
commit
5d03ae1650
4 changed files with 11 additions and 8 deletions
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -12470,9 +12470,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz",
|
||||
"integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==",
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.1.1.tgz",
|
||||
"integrity": "sha512-Veu0w4dTc/9wlWNf2jeRInNodKlcdLgemvPsrNpfu5Pq39sgfFjvIIgTsvUHCoLBnMhPoUA+tFxsXjU6VexVRQ==",
|
||||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
"test-listen": "1.1.0",
|
||||
"ts-jest": "23.1.4",
|
||||
"tslint": "5.11.0",
|
||||
"typescript": "3.0.3",
|
||||
"typescript": "3.1.1",
|
||||
"ws": "6.0.0",
|
||||
"yup": "0.26.5"
|
||||
},
|
||||
|
|
|
@ -313,7 +313,7 @@ export async function runHttpQuery(
|
|||
context = {} as Record<string, any>;
|
||||
} else if (typeof context === 'function') {
|
||||
try {
|
||||
context = await context();
|
||||
context = await (context as Function)();
|
||||
} catch (e) {
|
||||
e.message = `Context creation failed: ${e.message}`;
|
||||
// For errors that are not internal, such as authentication, we
|
||||
|
@ -342,11 +342,14 @@ export async function runHttpQuery(
|
|||
|
||||
for (const dataSource of Object.values(dataSources)) {
|
||||
if (dataSource.initialize) {
|
||||
dataSource.initialize({ context, cache: optionsObject.cache! });
|
||||
dataSource.initialize({
|
||||
context: context!,
|
||||
cache: optionsObject.cache!,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if ('dataSources' in context) {
|
||||
if ('dataSources' in context!) {
|
||||
throw new Error(
|
||||
'Please use the dataSources config option instead of putting dataSources on the context yourself.',
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@ export type EndHandler = (...errors: Array<Error>) => void;
|
|||
// arguments.
|
||||
type StartHandlerInvoker<TContext = any> = (
|
||||
ext: GraphQLExtension<TContext>,
|
||||
) => void;
|
||||
) => EndHandler | void;
|
||||
|
||||
// Copied from runQuery in apollo-server-core.
|
||||
// XXX Will this work properly if it's an identical interface of the
|
||||
|
|
Loading…
Add table
Reference in a new issue