Skip to content

Commit c133707

Browse files
committed
fix(ts): fix array type error issues
1 parent 2782a01 commit c133707

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

chapi-ast-typescript/src/main/antlr/TypeScriptParser.g4

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -598,6 +598,7 @@ arrayElement
598598
bindingElement
599599
: bindingPattern
600600
| Identifier
601+
| singleExpression
601602
;
602603

603604

@@ -729,7 +730,7 @@ multipleExportElements
729730
// Variable Statement
730731

731732
variableStatement
732-
: accessibilityModifier? ReadOnly? varModifier (bindingPatternBlock | variableDeclarationList) SemiColon?
733+
: accessibilityModifier? ReadOnly? varModifier (bindingPatternBlock | variableDeclarationList) eos?
733734
;
734735

735736
varModifier
@@ -747,8 +748,9 @@ variableDeclarationList
747748
;
748749

749750
variableDeclaration
750-
// : ( identifierName | arrayLiteral | objectLiteral) typeAnnotation? ('=' typeParameters? singleExpression)? // ECMAScript 6: Array & Object Matching
751-
: identifierName typeAnnotation? ('=' typeParameters? singleExpression)? // ECMAScript 6: Array & Object Matching
751+
: identifierName typeAnnotation? ('=' typeParameters? singleExpression)? // ECMAScript 6: Array & Object Matching
752+
| arrayLiteral
753+
| objectLiteral
752754
;
753755

754756

@@ -1016,6 +1018,8 @@ identifierOrKeyWord
10161018

10171019
identifierName
10181020
: reservedWord
1021+
| Lodash
1022+
| Dollar
10191023
| Identifier
10201024
;
10211025

0 commit comments

Comments
 (0)