Skip to content

Commit bb4102b

Browse files
committed
fix(core): assign TypeScript's codes to import attributes, raw JSX tokens, and .mts assertions
MESSAGE_CODES matched first and mapped those mistakes to TS1145, TS1012, and TS7060, hiding the parser table's TS2858, TS1382, and TS7059.
1 parent 197811a commit bb4102b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎packages/tsrx/src/diagnostics.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ const MESSAGE_CODES = [
276276
['A rest parameter cannot have an initializer.', 'TS1048'],
277277
['A rest parameter cannot be optional.', 'TS1047'],
278278
['A binding pattern parameter cannot be optional in an implementation signature.', 'TS2463'],
279-
[/^This syntax is reserved in files with the \.mts or \.cts extension\. /, 'TS7060'],
279+
[
280+
/^This syntax is reserved in files with the \.mts or \.cts extension\. Add a trailing comma/,
281+
'TS7060',
282+
],
280283
["'readonly' type modifier is only permitted on array and tuple literal types.", 'TS1354'],
281284
["'abstract' modifier can only appear on a class, method, or property declaration.", 'TS1242'],
282285
[
@@ -301,10 +304,10 @@ const MESSAGE_CODES = [
301304
['for-of loop variable declaration may not have an initializer', 'TS1190'],
302305
['Missing catch or finally clause', 'TS1472'],
303306
['Multiple default clauses', 'TS1113'],
304-
['Only string is supported as an attribute value', 'TS1145'],
307+
['Only string is supported as an attribute value', 'TS2858'],
305308
['value should be either an expression or a quoted text', 'TS1145'],
306309
['Unterminated JSX contents', 'TS17008'],
307-
[/^Unexpected token\b/, 'TS1012'],
310+
[/^Unexpected token$/, 'TS1012'],
308311
];
309312

310313
/**

0 commit comments

Comments
 (0)