mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-18 12:21:37 -06:00
Address comments
This commit is contained in:
parent
a4e21d7858
commit
f9846ff2bc
@ -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.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user