diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 74adccae08..8608245cfc 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2,6 +2,13 @@ /// namespace ts { + const enum SignatureContext { + Yield = 1 << 0, + Await = 1 << 1, + Type = 1 << 2, + RequireCompleteParameterList = 1 << 3, + } + let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; let IdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; @@ -2231,7 +2238,7 @@ namespace ts { else if (parseOptional(returnToken)) { signature.type = parseTypeOrTypePredicate(); } - else if (context === SignatureContext.Type) { + else if (context & SignatureContext.Type) { const start = scanner.getTokenPos(); const length = scanner.getTextPos() - start; const backwardToken = parseOptional(returnToken === SyntaxKind.ColonToken ? SyntaxKind.EqualsGreaterThanToken : SyntaxKind.ColonToken); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index eb4fac52b7..aefcce6d0b 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -36,13 +36,6 @@ namespace ts { end: number; } - export const enum SignatureContext { - Yield = 1 << 1, - Await = 1 << 2, - Type = 1 << 3, - RequireCompleteParameterList = 1 << 4, - } - // token > SyntaxKind.Identifer => token is a keyword // Also, If you add a new SyntaxKind be sure to keep the `Markers` section at the bottom in sync export const enum SyntaxKind {