Make parseTypeOrTypePredicate terser.

This commit is contained in:
Nathan Shively-Sanders 2016-01-13 09:31:06 -08:00
parent 9b13a0c5b9
commit a9f2cb6d6e

View file

@ -2541,11 +2541,7 @@ namespace ts {
} }
function parseTypeOrTypePredicate(): TypeNode { function parseTypeOrTypePredicate(): TypeNode {
let typePredicateVariable: Identifier; const typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
if (isIdentifier()) {
typePredicateVariable = tryParse(parseTypePredicatePrefix);
}
const type = parseType(); const type = parseType();
if (typePredicateVariable) { if (typePredicateVariable) {
const node = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typePredicateVariable.pos); const node = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typePredicateVariable.pos);