mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
add test for spread in tuple in non-last position
This commit is contained in:
@@ -109,6 +109,8 @@ test_VariableTypes
|
||||
| tst.ts:142:33:142:35 | msg | msg | tst.ts:142:39:142:44 | string |
|
||||
| tst.ts:148:25:148:27 | val | val | tst.ts:148:30:148:32 | any |
|
||||
| tst.ts:157:32:157:34 | arr | arr | tst.ts:157:37:157:56 | readonly [any, ...T] |
|
||||
| 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 |
|
||||
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 |
|
||||
@@ -201,6 +203,8 @@ test_TupleTypeExpr
|
||||
| tst.ts:136:39:136:68 | [number ... mber[]] | 2 | 3 | tst.ts:136:57:136:67 | ...number[] |
|
||||
| tst.ts:157:46:157:56 | [any, ...T] | 0 | 2 | tst.ts:157:47:157:49 | any |
|
||||
| tst.ts:157:46:157:56 | [any, ...T] | 1 | 2 | tst.ts:157:52:157:55 | ...T |
|
||||
| tst.ts:164:66:164:77 | [...T, ...U] | 0 | 2 | tst.ts:164:67:164:70 | ...T |
|
||||
| tst.ts:164:66:164:77 | [...T, ...U] | 1 | 2 | tst.ts:164:73:164:76 | ...U |
|
||||
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 |
|
||||
@@ -223,6 +227,7 @@ test_ArrayTypeExpr
|
||||
| tst.ts:135:39:135:46 | string[] | tst.ts:135:39:135:44 | string |
|
||||
| tst.ts:136:60:136:67 | number[] | tst.ts:136:60:136:65 | number |
|
||||
| tst.ts:157:25:157:29 | any[] | tst.ts:157:25:157:27 | any |
|
||||
| tst.ts:163:21:163:25 | any[] | tst.ts:163:21:163:23 | any |
|
||||
test_TypeAccessHelpers
|
||||
| tst.ts:65:18:65:24 | Generic | 1 | 0 | tst.ts:65:26:65:31 | number |
|
||||
| tst.ts:66:18:66:32 | N.InnerGeneric1 | 1 | 0 | tst.ts:66:34:66:39 | number |
|
||||
@@ -274,6 +279,7 @@ test_ReturnTypes
|
||||
| tst.ts:96:1:96:52 | functio ... rn x; } | function f3 | tst.ts:96:38:96:38 | S |
|
||||
| tst.ts:142:1:146:1 | functio ... )\\n }\\n} | function assert | tst.ts:142:48:142:64 | asserts condition |
|
||||
| tst.ts:148:1:152:1 | functio ... ;\\n }\\n} | function assertIsString | tst.ts:148:36:148:56 | asserts ... string |
|
||||
| tst.ts:164:1:166:1 | functio ... rr2];\\n} | function concat | tst.ts:164:66:164:77 | [...T, ...U] |
|
||||
test_KeyofTypeExpr
|
||||
| tst.ts:49:16:49:30 | keyof Interface | tst.ts:49:22:49:30 | Interface |
|
||||
| tst.ts:113:26:113:35 | keyof Node | tst.ts:113:32:113:35 | Node |
|
||||
|
||||
@@ -157,4 +157,10 @@ function assertIsString(val: any): asserts val is string {
|
||||
function tail<T extends any[]>(arr: readonly [any, ...T]) {
|
||||
const [_ignored, ...rest] = arr;
|
||||
return rest;
|
||||
}
|
||||
|
||||
// spread in tuple in non-last position
|
||||
type Arr = readonly any[];
|
||||
function concat<T extends Arr, U extends Arr>(arr1: T, arr2: U): [...T, ...U] {
|
||||
return [...arr1, ...arr2];
|
||||
}
|
||||
Reference in New Issue
Block a user