-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not parse template arguments in JavaScript files.
Fixes #36662.
- Loading branch information
Showing
9 changed files
with
69 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
tests/baselines/reference/getJavaScriptSyntacticDiagnostics14.baseline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Syntactic Diagnostics for file '/tests/cases/fourslash/getJavaScriptSyntacticDiagnostics14.ts': | ||
/tests/cases/fourslash/a.js(1,5): error TS8011: Type arguments can only be used in TypeScript files. | ||
/tests/cases/fourslash/a.js(1,13): error TS1109: Expression expected. | ||
|
||
|
||
==== /tests/cases/fourslash/a.js (1 errors) ==== | ||
Foo<number>(); | ||
~~~~~~ | ||
!!! error TS8011: Type arguments can only be used in TypeScript files. | ||
~ | ||
!!! error TS1109: Expression expected. |
35 changes: 23 additions & 12 deletions
35
tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
tests/cases/compiler/a.jsx(1,5): error TS8011: Type arguments can only be used in TypeScript files. | ||
tests/cases/compiler/a.jsx(2,5): error TS8011: Type arguments can only be used in TypeScript files. | ||
tests/cases/compiler/a.jsx(3,6): error TS8011: Type arguments can only be used in TypeScript files. | ||
tests/cases/compiler/a.jsx(4,6): error TS8011: Type arguments can only be used in TypeScript files. | ||
tests/cases/compiler/a.jsx(1,13): error TS1109: Expression expected. | ||
tests/cases/compiler/a.jsx(4,5): error TS1003: Identifier expected. | ||
tests/cases/compiler/a.jsx(4,14): error TS17002: Expected corresponding JSX closing tag for 'number'. | ||
tests/cases/compiler/a.jsx(4,20): error TS2657: JSX expressions must have one parent element. | ||
tests/cases/compiler/a.jsx(5,5): error TS1003: Identifier expected. | ||
tests/cases/compiler/a.jsx(5,6): error TS17008: JSX element 'number' has no corresponding closing tag. | ||
tests/cases/compiler/a.jsx(6,1): error TS1005: '</' expected. | ||
|
||
|
||
==== tests/cases/compiler/a.jsx (4 errors) ==== | ||
==== tests/cases/compiler/a.jsx (7 errors) ==== | ||
Foo<number>(); | ||
~~~~~~ | ||
!!! error TS8011: Type arguments can only be used in TypeScript files. | ||
~ | ||
!!! error TS1109: Expression expected. | ||
Foo<number>(1); | ||
Foo<number>``; | ||
~~~~~~ | ||
!!! error TS8011: Type arguments can only be used in TypeScript files. | ||
<Foo<number>></Foo>; | ||
~~~~~~ | ||
!!! error TS8011: Type arguments can only be used in TypeScript files. | ||
~ | ||
!!! error TS1003: Identifier expected. | ||
~~~~~~ | ||
!!! error TS17002: Expected corresponding JSX closing tag for 'number'. | ||
~ | ||
!!! error TS2657: JSX expressions must have one parent element. | ||
<Foo<number>/>; | ||
~ | ||
!!! error TS1003: Identifier expected. | ||
~~~~~~ | ||
!!! error TS8011: Type arguments can only be used in TypeScript files. | ||
!!! error TS17008: JSX element 'number' has no corresponding closing tag. | ||
|
||
|
||
!!! error TS1005: '</' expected. |
18 changes: 9 additions & 9 deletions
18
tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
//// [a.jsx] | ||
Foo<number>(); | ||
Foo<number>(1); | ||
Foo<number>``; | ||
<Foo<number>></Foo>; | ||
<Foo<number>/>; | ||
<Foo<number>/>; | ||
|
||
|
||
//// [a.js] | ||
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { | ||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | ||
return cooked; | ||
}; | ||
Foo(); | ||
Foo(__makeTemplateObject([""], [""])); | ||
<Foo></Foo>; | ||
<Foo />; | ||
Foo < number > (); | ||
Foo < number > (1); | ||
Foo < number > ""; | ||
<Foo />, <number>></Foo>; | ||
<Foo />, <number>/>; | ||
</>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters