Skip to content

Commit d78fa18

Browse files
committed
Ignore freshness in subtype reduction / Treat Object as {}
1 parent aa26980 commit d78fa18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -3357,7 +3357,7 @@ namespace ts {
33573357
// signatures, or if the property is actually declared in the type. In a union or intersection
33583358
// type, a property is considered known if it is known in any constituent type.
33593359
function isKnownProperty(type: Type, name: string): boolean {
3360-
if (type.flags & TypeFlags.ObjectType) {
3360+
if (type.flags & TypeFlags.ObjectType && type !== globalObjectType) {
33613361
var resolved = resolveStructuredTypeMembers(type);
33623362
return !!(resolved.properties.length === 0 ||
33633363
resolved.stringIndexType ||
@@ -3977,7 +3977,7 @@ namespace ts {
39773977

39783978
function isSubtypeOfAny(candidate: Type, types: Type[]): boolean {
39793979
for (let type of types) {
3980-
if (candidate !== type && isTypeSubtypeOf(candidate, type)) {
3980+
if (candidate !== type && isTypeSubtypeOf(getRegularTypeOfObjectLiteral(candidate), type)) {
39813981
return true;
39823982
}
39833983
}

0 commit comments

Comments
 (0)