forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
506 additions
and
18 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/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,11 +1,11 @@ | ||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. | ||
Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. | ||
tests/cases/compiler/a.js(1,5): error TS8011: 'type arguments' can only be used in a .ts file. | ||
tests/cases/compiler/a.js(1,13): error TS1109: Expression expected. | ||
|
||
|
||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' because it would overwrite input file. | ||
!!! error TS5055: Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig. | ||
==== tests/cases/compiler/a.js (1 errors) ==== | ||
Foo<number>(); | ||
~~~~~~ | ||
!!! error TS8011: 'type arguments' can only be used in a .ts file. | ||
~ | ||
!!! error TS1109: Expression expected. |
6 changes: 5 additions & 1 deletion
6
tests/baselines/reference/jsFileCompilationTypeArgumentSyntaxOfCall.types
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,5 +1,9 @@ | ||
=== tests/cases/compiler/a.js === | ||
Foo<number>(); | ||
>Foo<number>() : any | ||
>Foo<number>() : boolean | ||
>Foo<number : boolean | ||
>Foo : any | ||
>number : any | ||
>() : any | ||
> : any | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
tests/cases/compiler/a.js(1,4): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. | ||
tests/cases/compiler/a.js(4,1): error TS2365: Operator '<' cannot be applied to types '() => void' and 'number'. | ||
tests/cases/compiler/a.js(4,7): error TS1109: Expression expected. | ||
tests/cases/compiler/a.js(5,11): error TS1109: Expression expected. | ||
tests/cases/compiler/a.js(8,1): error TS2365: Operator '<' cannot be applied to types '(a: any) => void' and 'number'. | ||
tests/cases/compiler/a.js(8,1): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. | ||
tests/cases/compiler/a.js(11,9): error TS1146: Declaration expected. | ||
tests/cases/compiler/a.js(11,9): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. | ||
tests/cases/compiler/b.jsx(1,4): error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. | ||
tests/cases/compiler/b.jsx(4,12): error TS2695: Left side of comma operator is unused and has no side effects. | ||
tests/cases/compiler/b.jsx(4,18): error TS1003: Identifier expected. | ||
tests/cases/compiler/b.jsx(4,19): error TS1003: Identifier expected. | ||
tests/cases/compiler/b.jsx(4,22): error TS1109: Expression expected. | ||
tests/cases/compiler/b.jsx(4,30): error TS1109: Expression expected. | ||
tests/cases/compiler/c.ts(1,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. | ||
tests/cases/compiler/d.tsx(1,4): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. | ||
|
||
|
||
==== tests/cases/compiler/a.js (8 errors) ==== | ||
if((0)<0>(0)){ } | ||
~~~~~~~~~ | ||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. | ||
|
||
function f1() {} | ||
f1<1>(); | ||
~~~~ | ||
!!! error TS2365: Operator '<' cannot be applied to types '() => void' and 'number'. | ||
~ | ||
!!! error TS1109: Expression expected. | ||
new f1<1>(); | ||
~ | ||
!!! error TS1109: Expression expected. | ||
|
||
function t1(a) {} | ||
t1<1>``; | ||
~~~~ | ||
!!! error TS2365: Operator '<' cannot be applied to types '(a: any) => void' and 'number'. | ||
~~~~~~~ | ||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'string'. | ||
|
||
function sealed1(a) { return function seal(ctor) {} } | ||
@sealed1<1>(1) | ||
|
||
!!! error TS1146: Declaration expected. | ||
~~~~~~ | ||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. | ||
class Greeter1 {} | ||
|
||
==== tests/cases/compiler/b.jsx (6 errors) ==== | ||
if((0)<0>(0)){ } | ||
~~~~~~~~~ | ||
!!! error TS2365: Operator '>' cannot be applied to types 'boolean' and 'number'. | ||
|
||
function Test1() {} | ||
const a1 = <Test1<1>></Test1>; | ||
~~~~~~ | ||
!!! error TS2695: Left side of comma operator is unused and has no side effects. | ||
~ | ||
!!! error TS1003: Identifier expected. | ||
~ | ||
!!! error TS1003: Identifier expected. | ||
~~ | ||
!!! error TS1109: Expression expected. | ||
~ | ||
!!! error TS1109: Expression expected. | ||
|
||
==== tests/cases/compiler/c.ts (1 errors) ==== | ||
if((0)<0>(0)){ } | ||
~~~~~~~~~ | ||
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. | ||
|
||
function f2<T>() {} | ||
f2<1>(); | ||
new f2<1>(); | ||
|
||
function t2<T>(a) {} | ||
t2<1>``; | ||
|
||
function sealed2<T>(a: T) { return function seal(ctor) {} } | ||
@sealed2<1>(1) | ||
class Greeter2 {} | ||
|
||
==== tests/cases/compiler/d.tsx (1 errors) ==== | ||
if((0)<0>(0)){ } | ||
~~~~~~~~~ | ||
!!! error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'Number' has no compatible call signatures. | ||
|
||
function Test2<T>() {} | ||
const a2 = <Test2<1>></Test2> | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,94 @@ | ||
//// [tests/cases/compiler/typeArgumentsInJs.ts] //// | ||
|
||
//// [a.js] | ||
if((0)<0>(0)){ } | ||
|
||
function f1() {} | ||
f1<1>(); | ||
new f1<1>(); | ||
|
||
function t1(a) {} | ||
t1<1>``; | ||
|
||
function sealed1(a) { return function seal(ctor) {} } | ||
@sealed1<1>(1) | ||
class Greeter1 {} | ||
|
||
//// [b.jsx] | ||
if((0)<0>(0)){ } | ||
|
||
function Test1() {} | ||
const a1 = <Test1<1>></Test1>; | ||
|
||
//// [c.ts] | ||
if((0)<0>(0)){ } | ||
|
||
function f2<T>() {} | ||
f2<1>(); | ||
new f2<1>(); | ||
|
||
function t2<T>(a) {} | ||
t2<1>``; | ||
|
||
function sealed2<T>(a: T) { return function seal(ctor) {} } | ||
@sealed2<1>(1) | ||
class Greeter2 {} | ||
|
||
//// [d.tsx] | ||
if((0)<0>(0)){ } | ||
|
||
function Test2<T>() {} | ||
const a2 = <Test2<1>></Test2> | ||
|
||
|
||
|
||
//// [a.js] | ||
if ((0) < 0 > (0)) { } | ||
function f1() { } | ||
f1 < 1 > (); | ||
new f1 < 1 > (); | ||
function t1(a) { } | ||
t1 < 1 > ""; | ||
function sealed1(a) { return function seal(ctor) { }; } | ||
< 1 > (1); | ||
var Greeter1 = /** @class */ (function () { | ||
function Greeter1() { | ||
} | ||
return Greeter1; | ||
}()); | ||
//// [b.jsx] | ||
if ((0) < 0 > (0)) { } | ||
function Test1() { } | ||
var a1 = <Test1 />, < />; | ||
1 >> ; | ||
Test1 > ; | ||
//// [c.js] | ||
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { | ||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | ||
return cooked; | ||
}; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
if ((0)(0)) { } | ||
function f2() { } | ||
f2(); | ||
new f2(); | ||
function t2(a) { } | ||
t2(__makeTemplateObject([""], [""])); | ||
function sealed2(a) { return function seal(ctor) { }; } | ||
var Greeter2 = /** @class */ (function () { | ||
function Greeter2() { | ||
} | ||
Greeter2 = __decorate([ | ||
sealed2(1) | ||
], Greeter2); | ||
return Greeter2; | ||
}()); | ||
//// [d.jsx] | ||
if ((0)(0)) { } | ||
function Test2() { } | ||
var a2 = <Test2></Test2>; |
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
=== tests/cases/compiler/a.js === | ||
if((0)<0>(0)){ } | ||
|
||
function f1() {} | ||
>f1 : Symbol(f1, Decl(a.js, 0, 16)) | ||
|
||
f1<1>(); | ||
>f1 : Symbol(f1, Decl(a.js, 0, 16)) | ||
|
||
new f1<1>(); | ||
>f1 : Symbol(f1, Decl(a.js, 0, 16)) | ||
|
||
function t1(a) {} | ||
>t1 : Symbol(t1, Decl(a.js, 4, 12)) | ||
>a : Symbol(a, Decl(a.js, 6, 12)) | ||
|
||
t1<1>``; | ||
>t1 : Symbol(t1, Decl(a.js, 4, 12)) | ||
|
||
function sealed1(a) { return function seal(ctor) {} } | ||
>sealed1 : Symbol(sealed1, Decl(a.js, 7, 8)) | ||
>a : Symbol(a, Decl(a.js, 9, 17)) | ||
>seal : Symbol(seal, Decl(a.js, 9, 28)) | ||
>ctor : Symbol(ctor, Decl(a.js, 9, 43)) | ||
|
||
@sealed1<1>(1) | ||
>sealed1 : Symbol(sealed1, Decl(a.js, 7, 8)) | ||
|
||
class Greeter1 {} | ||
>Greeter1 : Symbol(Greeter1, Decl(a.js, 10, 14)) | ||
|
||
=== tests/cases/compiler/b.jsx === | ||
if((0)<0>(0)){ } | ||
|
||
function Test1() {} | ||
>Test1 : Symbol(Test1, Decl(b.jsx, 0, 16)) | ||
|
||
const a1 = <Test1<1>></Test1>; | ||
>a1 : Symbol(a1, Decl(b.jsx, 3, 5)) | ||
>Test1 : Symbol(Test1, Decl(b.jsx, 0, 16)) | ||
>Test1 : Symbol(Test1, Decl(b.jsx, 0, 16)) | ||
|
||
=== tests/cases/compiler/c.ts === | ||
if((0)<0>(0)){ } | ||
|
||
function f2<T>() {} | ||
>f2 : Symbol(f2, Decl(c.ts, 0, 16)) | ||
>T : Symbol(T, Decl(c.ts, 2, 12)) | ||
|
||
f2<1>(); | ||
>f2 : Symbol(f2, Decl(c.ts, 0, 16)) | ||
|
||
new f2<1>(); | ||
>f2 : Symbol(f2, Decl(c.ts, 0, 16)) | ||
|
||
function t2<T>(a) {} | ||
>t2 : Symbol(t2, Decl(c.ts, 4, 12)) | ||
>T : Symbol(T, Decl(c.ts, 6, 12)) | ||
>a : Symbol(a, Decl(c.ts, 6, 15)) | ||
|
||
t2<1>``; | ||
>t2 : Symbol(t2, Decl(c.ts, 4, 12)) | ||
|
||
function sealed2<T>(a: T) { return function seal(ctor) {} } | ||
>sealed2 : Symbol(sealed2, Decl(c.ts, 7, 8)) | ||
>T : Symbol(T, Decl(c.ts, 9, 17)) | ||
>a : Symbol(a, Decl(c.ts, 9, 20)) | ||
>T : Symbol(T, Decl(c.ts, 9, 17)) | ||
>seal : Symbol(seal, Decl(c.ts, 9, 34)) | ||
>ctor : Symbol(ctor, Decl(c.ts, 9, 49)) | ||
|
||
@sealed2<1>(1) | ||
>sealed2 : Symbol(sealed2, Decl(c.ts, 7, 8)) | ||
|
||
class Greeter2 {} | ||
>Greeter2 : Symbol(Greeter2, Decl(c.ts, 9, 59)) | ||
|
||
=== tests/cases/compiler/d.tsx === | ||
if((0)<0>(0)){ } | ||
|
||
function Test2<T>() {} | ||
>Test2 : Symbol(Test2, Decl(d.tsx, 0, 16)) | ||
>T : Symbol(T, Decl(d.tsx, 2, 15)) | ||
|
||
const a2 = <Test2<1>></Test2> | ||
>a2 : Symbol(a2, Decl(d.tsx, 3, 5)) | ||
>Test2 : Symbol(Test2, Decl(d.tsx, 0, 16)) | ||
>Test2 : Symbol(Test2, Decl(d.tsx, 0, 16)) | ||
|
||
|
Oops, something went wrong.