🔎 Search Terms
function inference
🕗 Version & Regression Information
- This changed between versions 5.9 and 6.0-rc
⏯ Playground Link
Playground Link
💻 Code
declarefunctiondeepEqual<T>(actualValue: T,expectedValue: T,message?: string): void;declarefunctioncompact<T>(obj: T): T// ErrordeepEqual(compact({a: "hello",b: undefined}),{a: "hello",});// OkdeepEqual({a: "hello",b: undefined},{a: "hello",});🙁 Actual behavior
First call fails. T for deepEqaul is inferred to { a: string, b: undefined;} instead of { a: string; b: undefined; } | { a: string; b?: undefined; } as it is for the second call that succeeds. In 5.9, T is inferred to { a: string; } which is not really great either.
🙂 Expected behavior
Both calls should pass type checking
Additional information about the issue
No response
🔎 Search Terms
function inference
🕗 Version & Regression Information
⏯ Playground Link
Playground Link
💻 Code
🙁 Actual behavior
First call fails.
Tfor deepEqaul is inferred to{ a: string, b: undefined;}instead of{ a: string; b: undefined; } | { a: string; b?: undefined; }as it is for the second call that succeeds. In 5.9,Tis inferred to{ a: string; }which is not really great either.🙂 Expected behavior
Both calls should pass type checking
Additional information about the issue
No response