-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
๐ Search Terms
NonNullable undefined
๐ Version & Regression Information
- This changed between versions 5.3 and 5.4.0-dev.20231202
โฏ Playground Link
๐ป Code
export interface CommonWrapper<P = {}> {
invoke<
K extends NonNullable<
{
[K in keyof P]: P[K] extends ((...arg: any[]) => void) | undefined ? K : never;
}[keyof P]
>,
>(
invokePropName: K,
): P[K];
}
interface OptionalFunctionProp {
functionProp?(): void;
}
declare const wrapper: CommonWrapper<OptionalFunctionProp>
wrapper.invoke("functionProp")
wrapper.invoke(undefined)๐ Actual behavior
No error
๐ Expected behavior
Argument of type 'undefined' is not assignable to parameter of type '"functionProp"'.(2345)
Additional information about the issue
Breaks @types/enzyme tests: https://github.com/DefinitelyTyped/DefinitelyTyped/actions/runs/7057196205/job/19245682552?pr=67570
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed