mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
add another test for spread elements in tuple types
This commit is contained in:
@@ -112,6 +112,7 @@ test_VariableTypes
|
||||
| tst.ts:164:47:164:50 | arr1 | arr1 | tst.ts:164:53:164:53 | T |
|
||||
| tst.ts:164:56:164:59 | arr2 | arr2 | tst.ts:164:62:164:62 | U |
|
||||
| tst.ts:169:31:169:31 | x | x | tst.ts:169:34:169:64 | [first: ... number] |
|
||||
| tst.ts:180:5:180:7 | foo | foo | tst.ts:180:10:180:21 | StrStrNumNum |
|
||||
test_QualifiedTypeAccess
|
||||
| tst.ts:63:19:63:21 | N.I | tst.ts:63:19:63:19 | N | tst.ts:63:21:63:21 | I |
|
||||
| tst.ts:64:20:64:24 | N.M.I | tst.ts:64:20:64:22 | N.M | tst.ts:64:24:64:24 | I |
|
||||
@@ -208,6 +209,12 @@ test_TupleTypeExpr
|
||||
| tst.ts:164:66:164:77 | [...T, ...U] | 1 | 2 | tst.ts:164:73:164:76 | ...U |
|
||||
| tst.ts:169:34:169:64 | [first: ... number] | 0 | 2 | tst.ts:169:42:169:47 | number |
|
||||
| tst.ts:169:34:169:64 | [first: ... number] | 1 | 2 | tst.ts:169:58:169:63 | number |
|
||||
| tst.ts:175:16:175:31 | [string, string] | 0 | 2 | tst.ts:175:17:175:22 | string |
|
||||
| tst.ts:175:16:175:31 | [string, string] | 1 | 2 | tst.ts:175:25:175:30 | string |
|
||||
| tst.ts:176:16:176:31 | [number, number] | 0 | 2 | tst.ts:176:17:176:22 | number |
|
||||
| tst.ts:176:16:176:31 | [number, number] | 1 | 2 | tst.ts:176:25:176:30 | number |
|
||||
| tst.ts:179:21:179:44 | [...Str ... umbers] | 0 | 2 | tst.ts:179:22:179:31 | ...Strings |
|
||||
| tst.ts:179:21:179:44 | [...Str ... umbers] | 1 | 2 | tst.ts:179:34:179:43 | ...Numbers |
|
||||
test_FieldTypes
|
||||
| tst.ts:15:3:15:22 | numberField: number; | tst.ts:15:16:15:21 | number |
|
||||
| tst.ts:16:3:16:22 | stringField: string; | tst.ts:16:16:16:21 | string |
|
||||
|
||||
@@ -169,4 +169,12 @@ function concat<T extends Arr, U extends Arr>(arr1: T, arr2: U): [...T, ...U] {
|
||||
function labelOnTupleElements(x: [first: number, second: number]): number {
|
||||
let [a, b] = x;
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
|
||||
// spread elements can occur anywhere in a tuple – not just at the end!
|
||||
type Strings = [string, string];
|
||||
type Numbers = [number, number];
|
||||
|
||||
// [string, string, number, number]
|
||||
type StrStrNumNum = [...Strings, ...Numbers];
|
||||
var foo: StrStrNumNum;
|
||||
Reference in New Issue
Block a user