mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-26 09:19:04 -05:00
Updated Breaking Changes (markdown)
@@ -40,12 +40,13 @@ function foo<T extends {}>(x: T) {
|
||||
}
|
||||
```
|
||||
|
||||
This behavior can come up in calls to
|
||||
This behavior can come up in calls to `Object.keys`:
|
||||
|
||||
```ts
|
||||
function keysEqual<T>(x: T, y: T) {
|
||||
const xKeys = Object.keys(x);
|
||||
const yKeys = Object.keys(y);
|
||||
|
||||
if (xKeys.length !== yKeys.length) return false;
|
||||
for (let i = 0; i < xKeys.length; i++) {
|
||||
if (xKeys[i] !== yKeys[i]) return false;
|
||||
@@ -64,6 +65,8 @@ No overload matches this call.
|
||||
Argument of type 'T' is not assignable to parameter of type 'object'.
|
||||
```
|
||||
|
||||
Appropriately performing runtime checks to narrow the type, or using a type-assertion, may be the best way to deal with these new errors.
|
||||
|
||||
For more information, take a look at [the breaking PR here](https://github.com/microsoft/TypeScript/pull/48366).
|
||||
|
||||
# TypeScript 4.7
|
||||
|
||||
Reference in New Issue
Block a user