Skip to content

Commit 1d5725d

Browse files
committed
Add tests and accept baselines
1 parent 47b3c6d commit 1d5725d

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,52 @@
11
tests/cases/compiler/tupleKinds.ts(1,22): error TS2370: A rest parameter must be of an array type.
2+
tests/cases/compiler/tupleKinds.ts(4,44): error TS1144: '{' or ';' expected.
3+
tests/cases/compiler/tupleKinds.ts(4,44): error TS2304: Cannot find name 'is'.
4+
tests/cases/compiler/tupleKinds.ts(4,47): error TS1005: ';' expected.
5+
tests/cases/compiler/tupleKinds.ts(4,47): error TS2304: Cannot find name 'boolean'.
6+
tests/cases/compiler/tupleKinds.ts(4,55): error TS1005: ';' expected.
7+
tests/cases/compiler/tupleKinds.ts(6,45): error TS1144: '{' or ';' expected.
8+
tests/cases/compiler/tupleKinds.ts(6,46): error TS2304: Cannot find name 'U'.
9+
tests/cases/compiler/tupleKinds.ts(8,29): error TS1005: '>' expected.
10+
tests/cases/compiler/tupleKinds.ts(8,37): error TS2304: Cannot find name 'string'.
11+
tests/cases/compiler/tupleKinds.ts(8,45): error TS1109: Expression expected.
12+
tests/cases/compiler/tupleKinds.ts(8,48): error TS2304: Cannot find name 'args'.
13+
tests/cases/compiler/tupleKinds.ts(8,52): error TS1005: ';' expected.
214

315

4-
==== tests/cases/compiler/tupleKinds.ts (1 errors) ====
5-
function tuple<...T>(...args:...T) {
16+
==== tests/cases/compiler/tupleKinds.ts (13 errors) ====
17+
function tuple<...T>(...args:...T): ...T {
618
~~~~~~~~~~~~
719
!!! error TS2370: A rest parameter must be of an array type.
820
return args;
921
}
22+
function noPredicates<...T>(...args): ...T is boolean {
23+
~~
24+
!!! error TS1144: '{' or ';' expected.
25+
~~
26+
!!! error TS2304: Cannot find name 'is'.
27+
~~~~~~~
28+
!!! error TS1005: ';' expected.
29+
~~~~~~~
30+
!!! error TS2304: Cannot find name 'boolean'.
31+
~
32+
!!! error TS1005: ';' expected.
33+
}
34+
function noArguments<...T, U>(...args): ...T<U> {
35+
~
36+
!!! error TS1144: '{' or ';' expected.
37+
~
38+
!!! error TS2304: Cannot find name 'U'.
39+
}
40+
function noConstraints<...T extends string>(...args) {
41+
~~~~~~~
42+
!!! error TS1005: '>' expected.
43+
~~~~~~
44+
!!! error TS2304: Cannot find name 'string'.
45+
~~~
46+
!!! error TS1109: Expression expected.
47+
~~~~
48+
!!! error TS2304: Cannot find name 'args'.
49+
~
50+
!!! error TS1005: ';' expected.
51+
}
1052

tests/baselines/reference/tupleKinds.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
//// [tupleKinds.ts]
2-
function tuple<...T>(...args:...T) {
2+
function tuple<...T>(...args:...T): ...T {
33
return args;
44
}
5+
function noPredicates<...T>(...args): ...T is boolean {
6+
}
7+
function noArguments<...T, U>(...args): ...T<U> {
8+
}
9+
function noConstraints<...T extends string>(...args) {
10+
}
511

612

713
//// [tupleKinds.js]
@@ -12,3 +18,12 @@ function tuple() {
1218
}
1319
return args;
1420
}
21+
is;
22+
boolean;
23+
{
24+
}
25+
{};
26+
string > ();
27+
args;
28+
{
29+
}

tests/cases/compiler/tupleKinds.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
function tuple<...T>(...args:...T) {
1+
function tuple<...T>(...args:...T): ...T {
22
return args;
33
}
4+
function noPredicates<...T>(...args): ...T is boolean {
5+
}
6+
function noArguments<...T, U>(...args): ...T<U> {
7+
}
8+
function noConstraints<...T extends string>(...args) {
9+
}

0 commit comments

Comments
 (0)