Skip to content

Commit 77399ac

Browse files
committed
fix(ts): fix typed error
1 parent ddd139e commit 77399ac

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,8 @@ formalParameterList
686686
formalParameterArg
687687
: decorator? accessibilityModifier? identifierOrKeyWord '?'? typeAnnotation? ('=' singleExpression)? // ECMAScript 6: Initialization
688688
| lastFormalParameterArg
689-
| arrayLiteral // ECMAScript 6: Parameter Context Matching
689+
// ([key, value]: [string, string[]])
690+
| arrayLiteral (':' formalParameterList)? // ECMAScript 6: Parameter Context Matching
690691
| objectLiteral (':' formalParameterList)? // ECMAScript 6: Parameter Context Matching
691692
// `addThing({ payload }, { call }){}`
692693
| objectLiteral (',' objectLiteral)* // ECMAScript 6: Parameter Context Matching

chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptRegressionTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,13 @@ import {EMPTY, Observable, of} from 'rxjs';
4747
} """
4848
TypeScriptAnalyser().analysis(code, "index.tsx")
4949
}
50+
51+
@Test
52+
fun nested_type_type_error() {
53+
val code = """Object.entries(values).forEach(([key, value]: [string, string[]]) => {
54+
55+
});
56+
"""
57+
TypeScriptAnalyser().analysis(code, "index.tsx")
58+
}
5059
}

0 commit comments

Comments
 (0)