mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 01:33:15 -05:00
Address comments
This commit is contained in:
@@ -2538,13 +2538,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
function parseTypeOrTypePredicate(): TypeNode {
|
||||
const typePredicateVariable = tryParse(() => {
|
||||
const id = parseIdentifier();
|
||||
if (token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
|
||||
nextToken();
|
||||
return id;
|
||||
}
|
||||
});
|
||||
let typePredicateVariable: Identifier;
|
||||
if (isIdentifier()) {
|
||||
typePredicateVariable = tryParse(parseTypePredicatePrefix);
|
||||
}
|
||||
|
||||
const type = parseType();
|
||||
if (typePredicateVariable) {
|
||||
const node = <TypePredicateNode>createNode(SyntaxKind.TypePredicate, typePredicateVariable.pos);
|
||||
@@ -2557,6 +2555,14 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
function parseTypePredicatePrefix() {
|
||||
const id = parseIdentifier();
|
||||
if (token === SyntaxKind.IsKeyword && !scanner.hasPrecedingLineBreak()) {
|
||||
nextToken();
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
function parseType(): TypeNode {
|
||||
// The rules about 'yield' only apply to actual code/expression contexts. They don't
|
||||
// apply to 'type' contexts. So we disable these parameters here before moving on.
|
||||
|
||||
Reference in New Issue
Block a user