I attempted to upgrade from typescript@4.2 to typescript@4.9, but there are breaking changes in typescript@4.5 which prevent the upgrade.
Restrictions on Assignability to Conditional Types
TypeScript no longer allows types to be assignable to conditional types that use infer, or that are distributive. Doing so previously often ended up causing major performance issues. For more information, see the specific change on GitHub.
The following code seems to make use of this feature:
ERROR in /home/benjamin/projects/noteworthy/src/main/app.ts
190:21-42
[tsl] ERROR in /home/benjamin/projects/noteworthy/src/main/app.ts(190,22)
TS2344: Type 'MainIpcHandlers[C][T]' does not satisfy the constraint '(...args: any) => any'.
Type 'MainIpcHandlers[C][FunctionPropertyNames<MainIpcHandlers[C]>]' is not assignable to type '(...args: any) => any'.
Type 'MainIpcHandlers[C][keyof MainIpcHandlers[C] extends string ? MainIpcHandlers[C][string & keyof MainIpcHandlers[C]] extends Function ? string & keyof MainIpcHandlers[C] : never : never]' is not assignable to type '(...args: any) => any'.
Type 'MainIpcHandlers[C][MainIpcHandlers[C][string] extends Function ? string : never]' is not assignable to type '(...args: any) => any'.
Type 'MainIpcHandlers[C][string]' is not assignable to type '(...args: any) => any'.
ERROR in /home/benjamin/projects/noteworthy/src/main/app.ts
196:9-43
[tsl] ERROR in /home/benjamin/projects/noteworthy/src/main/app.ts(196,10)
TS2349: This expression is not callable.
Type 'unknown' has no call signatures.
For more information see microsoft/TypeScript#46429.
I attempted to upgrade from
typescript@4.2
totypescript@4.9
, but there are breaking changes intypescript@4.5
which prevent the upgrade.The following code seems to make use of this feature:
https://github.com/benrbray/noteworthy/blob/4715af91875fe7507eea083df2c418a4ce3513fc/src/main/app.ts#L186-L197
https://github.com/benrbray/noteworthy/blob/ab309d39ad0d01ee2f518de435ae8e02be82a478/src/common/ipc.ts#L12-L17
https://github.com/benrbray/noteworthy/blob/4715af91875fe7507eea083df2c418a4ce3513fc/src/main/MainIPC.ts#L25-L47
I receive the following compile error:
For more information see microsoft/TypeScript#46429.