@@ -138,6 +138,11 @@ namespace ts {
138
138
const silentNeverType = createIntrinsicType(TypeFlags.Never, "never");
139
139
140
140
const emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
141
+
142
+ const emptyTypeLiteralSymbol = createSymbol(SymbolFlags.TypeLiteral | SymbolFlags.Transient, "__type");
143
+ emptyTypeLiteralSymbol.members = createMap<Symbol>();
144
+ const emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined);
145
+
141
146
const emptyGenericType = <GenericType><ObjectType>createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined);
142
147
emptyGenericType.instantiations = createMap<TypeReference>();
143
148
@@ -5696,10 +5701,15 @@ namespace ts {
5696
5701
const links = getNodeLinks(node);
5697
5702
if (!links.resolvedType) {
5698
5703
// Deferred resolution of members is handled by resolveObjectTypeMembers
5699
- const type = createObjectType(ObjectFlags.Anonymous, node.symbol);
5700
- type.aliasSymbol = aliasSymbol;
5701
- type.aliasTypeArguments = aliasTypeArguments;
5702
- links.resolvedType = type;
5704
+ if (isEmpty(node.symbol.members) && !aliasSymbol && !aliasTypeArguments) {
5705
+ links.resolvedType = emptyTypeLiteralType;
5706
+ }
5707
+ else {
5708
+ const type = createObjectType(ObjectFlags.Anonymous, node.symbol);
5709
+ type.aliasSymbol = aliasSymbol;
5710
+ type.aliasTypeArguments = aliasTypeArguments;
5711
+ links.resolvedType = type;
5712
+ }
5703
5713
}
5704
5714
return links.resolvedType;
5705
5715
}
@@ -6036,6 +6046,9 @@ namespace ts {
6036
6046
}
6037
6047
6038
6048
function isSymbolInScopeOfMappedTypeParameter(symbol: Symbol, mapper: TypeMapper) {
6049
+ if (!(symbol.declarations && symbol.declarations.length)) {
6050
+ return false;
6051
+ }
6039
6052
const mappedTypes = mapper.mappedTypes;
6040
6053
// Starting with the parent of the symbol's declaration, check if the mapper maps any of
6041
6054
// the type parameters introduced by enclosing declarations. We just pick the first
0 commit comments