```ts // @strictNullChecks: true interface Data { data: any } declare const value: Data | undefined; function doSthWithValue(v: undefined): undefined; function doSthWithValue(v: Data): Data; function doSthWithValue(v?: Data) { return v; } const a = doSthWithValue(value); // <-- error ``` _EDIT: see comment below, it is not connected to `strictNullChecks`_ **Expected behavior:** Should not throw error with `strictNullChecks` enabled **Actual behavior:** It throws error: ``` Argument of type 'Data | undefined' is not assignable to parameter of type 'undefined'. Type 'Data' is not assignable to type 'undefined'. ``` **Playground Link:** Enable `strictNullChecks`. The order of overloaded signatures does not change anything https://www.typescriptlang.org/play/#src=interface%20Data%20%7B%0D%0A%20%20%20%20data%3A%20any%0D%0A%7D%0D%0A%0D%0Adeclare%20const%20value%3A%20Data%20%7C%20undefined%3B%0D%0A%0D%0Afunction%20doSthWithValue(v%3A%20undefined)%3A%20undefined%3B%0D%0Afunction%20doSthWithValue(v%3A%20Data)%3A%20Data%3B%0D%0Afunction%20doSthWithValue(v%3F%3A%20Data)%20%7B%0D%0A%20%20%20%20return%20v%3B%0D%0A%7D%0D%0A%0D%0Aconst%20a%20%3D%20doSthWithValue(value)%3B%0D%0A **Related issues:** #14107
EDIT: see comment below, it is not connected to
strictNullChecksExpected behavior:
Should not throw error with
strictNullChecksenabledActual behavior:
It throws error:
Playground Link:
Enable
strictNullChecks. The order of overloaded signatures does not change anythinghttps://www.typescriptlang.org/play/#src=interface%20Data%20%7B%0D%0A%20%20%20%20data%3A%20any%0D%0A%7D%0D%0A%0D%0Adeclare%20const%20value%3A%20Data%20%7C%20undefined%3B%0D%0A%0D%0Afunction%20doSthWithValue(v%3A%20undefined)%3A%20undefined%3B%0D%0Afunction%20doSthWithValue(v%3A%20Data)%3A%20Data%3B%0D%0Afunction%20doSthWithValue(v%3F%3A%20Data)%20%7B%0D%0A%20%20%20%20return%20v%3B%0D%0A%7D%0D%0A%0D%0Aconst%20a%20%3D%20doSthWithValue(value)%3B%0D%0A
Related issues:
#14107