Closed
Description
declare function hasOwnProperty<P extends PropertyKey>(target: {}, property: P): target is { [K in P]: unknown };
declare const arrayLikeOrIterable: ArrayLike<any> | Iterable<any>;
if (hasOwnProperty(arrayLikeOrIterable, 'length')) {
arrayLikeOrIterable; // $ExpectType ArrayLike<any>
}
Expected: arrayLikeOrIterable narrows to ArrayLike<any>
Actual: It doesn't, so instead the compiler intersects the declared type with { length: unknown }
.
Broken by #47069