Skip to content

Commit

Permalink
fix(ts): fix type abstract ? issues
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 15, 2022
1 parent 9d8bfe5 commit d704aae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions chapi-ast-typescript/src/main/antlr/TypeScriptParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ typeAnnotation
;

callSignature
: typeParameters? '(' parameterList? ','? ')' typeAnnotation?
: typeParameters? '(' parameterList? ','? ')' typeAnnotation? ';'?
;

parameterList
Expand Down Expand Up @@ -390,7 +390,7 @@ statementList
;

abstractDeclaration
: Abstract (Identifier callSignature | variableStatement) eos
: Abstract (Identifier '?'? callSignature | variableStatement) eos
;

importStatement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ export class DemoComponent implements OnInit, ControlValueAccessor {
TypeScriptAnalyser().analysis(code2, "index.tsx")
}

@Test
fun type_in_interface() {
val code = """export abstract class ReactiveOptionProviderService<T extends SelectOption> {
abstract create?(name: string): Observable<T>;
}"""

TypeScriptAnalyser().analysis(code, "index.tsx")
}

@Test
fun numeric_separators() {
val code = """if (+value > 1_000_000_000) {
Expand Down

0 comments on commit d704aae

Please sign in to comment.