diff --git a/CHANGELOG.md b/CHANGELOG.md index 2098e0f15a4..83492eca872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The version headers in this history reflect the versions of Apollo Server itself > The changes noted within this `vNEXT` section have not been released yet. New PRs and commits which introduce changes should include an entry in this `vNEXT` section as part of their development. When a release is being prepared, a new header will be (manually) created below and the the appropriate changes within that release will be moved into the new section. -- _Nothing yet. Stay tuned!_ +- `apollo-server-core`: Upgrade TS to 3.7.3 [#3618](https://github.com/apollographql/apollo-server/pull/3618) ### v2.9.14 diff --git a/package-lock.json b/package-lock.json index 6fc73aea925..d7626102b93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15091,9 +15091,9 @@ "dev": true }, "typescript": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.2.tgz", - "integrity": "sha512-lmQ4L+J6mnu3xweP8+rOrUwzmN+MRAj7TgtJtDaXE5PMyX2kCrklhg3rvOsOIfNeAWMQWO2F1GPc1kMD2vLAfw==", + "version": "3.7.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz", + "integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==", "dev": true }, "uglify-js": { diff --git a/package.json b/package.json index 139b38f6472..d148e8441d4 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "supertest": "4.0.2", "test-listen": "1.1.0", "ts-jest": "24.2.0", - "typescript": "3.6.2", + "typescript": "3.7.3", "ws": "6.2.1" }, "jest": { diff --git a/packages/apollo-server-core/src/utils/dispatcher.ts b/packages/apollo-server-core/src/utils/dispatcher.ts index f42354cfec6..d311eaf055a 100644 --- a/packages/apollo-server-core/src/utils/dispatcher.ts +++ b/packages/apollo-server-core/src/utils/dispatcher.ts @@ -1,19 +1,16 @@ +import { GraphQLRequestListener } from "apollo-server-plugin-base"; + type AnyFunction = (...args: any[]) => any; type Args = F extends (...args: infer A) => any ? A : never; -type FunctionPropertyNames = { - [K in keyof T]: T[K] extends F ? K : never; -}[keyof T]; type AsFunction = F extends AnyFunction ? F : never; type UnwrapPromise = T extends Promise ? U : T; type DidEndHook = (...args: TArgs) => void; -export class Dispatcher { +export class Dispatcher { constructor(protected targets: T[]) {} - public async invokeHookAsync< - TMethodName extends FunctionPropertyNames> - >( + public async invokeHookAsync( methodName: TMethodName, ...args: Args ): Promise>>[]> { @@ -27,9 +24,7 @@ export class Dispatcher { ); } - public async invokeHooksUntilNonNull< - TMethodName extends FunctionPropertyNames> - >( + public async invokeHooksUntilNonNull( methodName: TMethodName, ...args: Args ): Promise>> | null> { @@ -47,10 +42,7 @@ export class Dispatcher { } public invokeDidStartHook< - TMethodName extends FunctionPropertyNames< - Required, - (...args: any[]) => AnyFunction | void - >, + TMethodName extends keyof T, TEndHookArgs extends Args>> >( methodName: TMethodName,