Closed
Description
Bug Report
π Search Terms
π Version & Regression Information
- Regression in: 4.7.0-dev.20220325
- Works in 4.7.0-dev.20220323
β― Playground Link
Playground currently doesn't show the error:
π» Code
function deepEquals<T>(a: T, b: T): boolean {
if (typeof a !== 'object' || typeof b !== 'object' || !a || !b) {
return false;
}
if (Array.isArray(a) || Array.isArray(b)) {
return false;
}
if (Object.keys(a).length !== Object.keys(b).length) { // Error here
return false;
}
return true;
}
π Actual behavior
The calls to Object.keys
generate errors:
No overload matches this call.
Overload 1 of 2, '(o: {}): string[]', gave the following error.
Argument of type 'T' is not assignable to parameter of type '{}'.
Overload 2 of 2, '(o: object): string[]', gave the following error.
Argument of type 'T' is not assignable to parameter of type 'object'.
π Expected behavior
No errors