Skip to content

Commit

Permalink
fix(compiler): fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb authored and jasonaden committed Jul 8, 2017
1 parent 2763577 commit 5ea9b62
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/compiler/src/expression_parser/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,24 +290,24 @@ export class _ParseAST {
this.error(`Missing expected operator ${operator}`);
}

expectIdentifierOrKeyword(): string|null {
expectIdentifierOrKeyword(): string {
const n = this.next;
if (!n.isIdentifier() && !n.isKeyword()) {
this.error(`Unexpected token ${n}, expected identifier or keyword`);
return '';
}
this.advance();
return n.toString();
return n.toString() as string;
}

expectIdentifierOrKeywordOrString(): string|null {
expectIdentifierOrKeywordOrString(): string {
const n = this.next;
if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
this.error(`Unexpected token ${n}, expected identifier, keyword, or string`);
return '';
}
this.advance();
return n.toString();
return n.toString() as string;
}

parseChain(): AST {
Expand Down Expand Up @@ -340,7 +340,7 @@ export class _ParseAST {
}

do {
const name = this.expectIdentifierOrKeyword() !;
const name = this.expectIdentifierOrKeyword();
const args: AST[] = [];
while (this.optionalCharacter(chars.$COLON)) {
args.push(this.parseExpression());
Expand Down Expand Up @@ -612,7 +612,7 @@ export class _ParseAST {
if (!this.optionalCharacter(chars.$RBRACE)) {
this.rbracesExpected++;
do {
const key = this.expectIdentifierOrKeywordOrString() !;
const key = this.expectIdentifierOrKeywordOrString();
keys.push(key);
this.expectCharacter(chars.$COLON);
values.push(this.parsePipe());
Expand All @@ -625,7 +625,7 @@ export class _ParseAST {

parseAccessMemberOrMethodCall(receiver: AST, isSafe: boolean = false): AST {
const start = receiver.span.start;
const id = this.expectIdentifierOrKeyword() !;
const id = this.expectIdentifierOrKeyword();

if (this.optionalCharacter(chars.$LPAREN)) {
this.rparensExpected++;
Expand Down

0 comments on commit 5ea9b62

Please sign in to comment.