Add eof as a TS list terminator break
MODIFY
packages/@romejs/js-parser/parser/typescript.ts
packages/@romejs/js-parser/parser/typescript.ts
@@ -191,6 +191,10 @@ export function hasTSModifier(
}
function tsIsListTerminator(parser: JSParser, kind: ParsingContext): boolean {
+ if (parser.match(tt.eof)) {
+ return true;
+ }
+
switch (kind) {
case 'EnumMembers':
case 'TypeMembers':

ADD
packages/@romejs/js-parser/test-fixtures/typescript/tsx/regression-342/input.test.md
+# `index.test.ts`
+
+**DO NOT MODIFY**. This file has been autogenerated. Run `rome test packages/@romejs/js-parser/index.test.ts --update-snapshots` to update.
+
+## `typescript > tsx > regression-342`
+
+```javascript
+Program {
+ comments: Array []
+ corrupt: false
+ diagnostics: Array []
+ directives: Array []
+ filename: 'input.tsx'
+ hasHoistedVars: false
+ interpreter: undefined
+ mtime: undefined
+ sourceType: 'module'
+ syntax: Array [
+ 'jsx'
+ 'ts'
+ ]
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 27
+ index: 27
+ line: 1
+ }
+ start: Object {
+ column: 0
+ index: 0
+ line: 1
+ }
+ }
+ body: Array [
+ ExpressionStatement {
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 27
+ index: 27
+ line: 1
+ }
+ start: Object {
+ column: 0
+ index: 0
+ line: 1
+ }
+ }
+ expression: ConditionalExpression {
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 27
+ index: 27
+ line: 1
+ }
+ start: Object {
+ column: 0
+ index: 0
+ line: 1
+ }
+ }
+ test: NumericLiteral {
+ value: 0
+ format: undefined
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 1
+ index: 1
+ line: 1
+ }
+ start: Object {
+ column: 0
+ index: 0
+ line: 1
+ }
+ }
+ }
+ alternate: JSXElement {
+ name: JSXIdentifier {
+ name: 'b'
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 20
+ index: 20
+ line: 1
+ }
+ start: Object {
+ column: 19
+ index: 19
+ line: 1
+ }
+ }
+ }
+ attributes: Array []
+ selfClosing: false
+ typeArguments: undefined
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 26
+ index: 26
+ line: 1
+ }
+ start: Object {
+ column: 18
+ index: 18
+ line: 1
+ }
+ }
+ children: Array [
+ JSXText {
+ value: '0'
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 22
+ index: 22
+ line: 1
+ }
+ start: Object {
+ column: 21
+ index: 21
+ line: 1
+ }
+ }
+ }
+ ]
+ }
+ consequent: JSXElement {
+ name: JSXIdentifier {
+ name: 'b'
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 7
+ index: 7
+ line: 1
+ }
+ start: Object {
+ column: 6
+ index: 6
+ line: 1
+ }
+ }
+ }
+ attributes: Array []
+ selfClosing: false
+ typeArguments: undefined
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 13
+ index: 13
+ line: 1
+ }
+ start: Object {
+ column: 5
+ index: 5
+ line: 1
+ }
+ }
+ children: Array [
+ JSXText {
+ value: '0'
+ loc: Object {
+ filename: 'input.tsx'
+ end: Object {
+ column: 9
+ index: 9
+ line: 1
+ }
+ start: Object {
+ column: 8
+ index: 8
+ line: 1
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ ]
+}
+```

ADD
packages/@romejs/js-parser/test-fixtures/typescript/tsx/regression-342/input.tsx
+0 ? (<b>0</b>) : (<b>0</b>)
\ No newline at end of file

Add eof as a TS list terminator break