@@ -1839,7 +1839,7 @@ namespace ts {
1839
1839
if (symbol.flags & SymbolFlags.Variable) {
1840
1840
const typeAnnotation = (<VariableDeclaration>symbol.valueDeclaration).type;
1841
1841
if (typeAnnotation) {
1842
- return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name)); // TODO: GH#18217
1842
+ return resolveSymbol(getPropertyOfType(getTypeFromTypeNode(typeAnnotation), name));
1843
1843
}
1844
1844
}
1845
1845
}
@@ -6865,11 +6865,7 @@ namespace ts {
6865
6865
return obj.properties.some(property => {
6866
6866
const name = property.name && getTextOfPropertyName(property.name);
6867
6867
const expected = name === undefined ? undefined : getTypeOfPropertyOfType(contextualType, name);
6868
- if (expected && typeIsLiteralType(expected)) {
6869
- const actual = getTypeOfNode(property);
6870
- return !!actual && !isTypeIdenticalTo(actual, expected);
6871
- }
6872
- return false;
6868
+ return !!expected && typeIsLiteralType(expected) && !isTypeIdenticalTo(getTypeOfNode(property), expected);
6873
6869
});
6874
6870
}
6875
6871
@@ -9841,7 +9837,7 @@ namespace ts {
9841
9837
case SyntaxKind.Identifier:
9842
9838
case SyntaxKind.QualifiedName:
9843
9839
const symbol = getSymbolAtLocation(node);
9844
- return ( symbol && getDeclaredTypeOfSymbol(symbol))!; // TODO: GH#18217
9840
+ return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
9845
9841
default:
9846
9842
return errorType;
9847
9843
}
@@ -19414,7 +19410,7 @@ namespace ts {
19414
19410
}
19415
19411
19416
19412
const typeArgumentNodes: ReadonlyArray<TypeNode> = callLikeExpressionMayHaveTypeArguments(node) ? node.typeArguments || emptyArray : emptyArray;
19417
- const typeArguments = typeArgumentNodes.map(n => getTypeOfNode(n) || anyType );
19413
+ const typeArguments = typeArgumentNodes.map(getTypeOfNode);
19418
19414
while (typeArguments.length > typeParameters.length) {
19419
19415
typeArguments.pop();
19420
19416
}
@@ -27267,7 +27263,7 @@ namespace ts {
27267
27263
grandParent.kind === SyntaxKind.ObjectBindingPattern &&
27268
27264
node === (<BindingElement>parent).propertyName) {
27269
27265
const typeOfPattern = getTypeOfNode(grandParent);
27270
- const propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, (<Identifier>node).escapedText);
27266
+ const propertyDeclaration = getPropertyOfType(typeOfPattern, (<Identifier>node).escapedText);
27271
27267
27272
27268
if (propertyDeclaration) {
27273
27269
return propertyDeclaration;
@@ -27367,7 +27363,7 @@ namespace ts {
27367
27363
if (isPartOfTypeNode(node)) {
27368
27364
let typeFromTypeNode = getTypeFromTypeNode(<TypeNode>node);
27369
27365
27370
- if (typeFromTypeNode && isExpressionWithTypeArgumentsInClassImplementsClause(node)) {
27366
+ if (isExpressionWithTypeArgumentsInClassImplementsClause(node)) {
27371
27367
const containingClass = getContainingClass(node)!;
27372
27368
const classType = getTypeOfNode(containingClass) as InterfaceType;
27373
27369
typeFromTypeNode = getTypeWithThisArgument(typeFromTypeNode, classType.thisType);
@@ -27385,8 +27381,8 @@ namespace ts {
27385
27381
// extends clause of a class. We handle that case here.
27386
27382
const classNode = getContainingClass(node)!;
27387
27383
const classType = getDeclaredTypeOfSymbol(getSymbolOfNode(classNode)) as InterfaceType;
27388
- const baseType = getBaseTypes(classType)[0] ;
27389
- return baseType && getTypeWithThisArgument(baseType, classType.thisType);
27384
+ const baseType = firstOrUndefined( getBaseTypes(classType)) ;
27385
+ return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType ;
27390
27386
}
27391
27387
27392
27388
if (isTypeDeclaration(node)) {
0 commit comments