Skip to content

Commit 98c56ae

Browse files
committed
PR feedback
1 parent 9a590db commit 98c56ae

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

src/compiler/checker.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8768,19 +8768,28 @@ module ts {
87688768
*/
87698769
function checkTypeAnnotationAsExpression(node: AccessorDeclaration | PropertyDeclaration | ParameterDeclaration | MethodDeclaration) {
87708770
switch (node.kind) {
8771-
case SyntaxKind.PropertyDeclaration: return checkTypeNodeAsExpression((<PropertyDeclaration>node).type);
8772-
case SyntaxKind.Parameter: return checkTypeNodeAsExpression((<ParameterDeclaration>node).type);
8773-
case SyntaxKind.MethodDeclaration: return checkTypeNodeAsExpression((<MethodDeclaration>node).type);
8774-
case SyntaxKind.GetAccessor: return checkTypeNodeAsExpression((<AccessorDeclaration>node).type);
8775-
case SyntaxKind.SetAccessor: return checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(<AccessorDeclaration>node));
8771+
case SyntaxKind.PropertyDeclaration:
8772+
checkTypeNodeAsExpression((<PropertyDeclaration>node).type);
8773+
break;
8774+
case SyntaxKind.Parameter: checkTypeNodeAsExpression((<ParameterDeclaration>node).type);
8775+
break;
8776+
case SyntaxKind.MethodDeclaration:
8777+
checkTypeNodeAsExpression((<MethodDeclaration>node).type);
8778+
break;
8779+
case SyntaxKind.GetAccessor:
8780+
checkTypeNodeAsExpression((<AccessorDeclaration>node).type);
8781+
break;
8782+
case SyntaxKind.SetAccessor:
8783+
checkTypeNodeAsExpression(getSetAccessorTypeAnnotationNode(<AccessorDeclaration>node));
8784+
break;
87768785
}
87778786
}
87788787

87798788
/** Checks the type annotation of the parameters of a function/method or the constructor of a class as expressions */
87808789
function checkParameterTypeAnnotationsAsExpressions(node: FunctionLikeDeclaration) {
87818790
// ensure all type annotations with a value declaration are checked as an expression
8782-
if (node) {
8783-
forEach(node.parameters, checkTypeAnnotationAsExpression);
8791+
for (let parameter of node.parameters) {
8792+
checkTypeAnnotationAsExpression(parameter);
87848793
}
87858794
}
87868795

@@ -11624,7 +11633,9 @@ module ts {
1162411633
case SyntaxKind.TypeLiteral:
1162511634
case SyntaxKind.UnionType:
1162611635
case SyntaxKind.AnyKeyword:
11636+
break;
1162711637
default:
11638+
Debug.fail("Cannot serialize unexpected type node.");
1162811639
break;
1162911640
}
1163011641
}

0 commit comments

Comments
 (0)