@@ -1177,7 +1177,7 @@ type CreateTuple<L, V = string> =
1177
1177
1178
1178
( function describe ( _ = 'combineWithAllErrors' ) {
1179
1179
( function it ( _ = 'combines different results into one' ) {
1180
- type Expectation = Result < [ number , string , never , never ] , [ never , never , string [ ] , Error ] > ;
1180
+ type Expectation = Result < [ number , string , never , never ] , ( string [ ] | Error ) [ ] > ;
1181
1181
1182
1182
const result = Result . combineWithAllErrors ( [
1183
1183
ok ( 1 ) ,
@@ -1191,7 +1191,7 @@ type CreateTuple<L, V = string> =
1191
1191
} ) ;
1192
1192
1193
1193
( function it ( _ = 'combines only ok results into one' ) {
1194
- type Expectation = Result < [ number , string ] , [ never , never ] > ;
1194
+ type Expectation = Result < [ number , string ] , never [ ] > ;
1195
1195
1196
1196
const result = Result . combineWithAllErrors ( [
1197
1197
ok ( 1 ) ,
@@ -1203,7 +1203,7 @@ type CreateTuple<L, V = string> =
1203
1203
} ) ;
1204
1204
1205
1205
( function it ( _ = 'combines only err results into one' ) {
1206
- type Expectation = Result < [ never , never ] , [ number , 'string' ] > ;
1206
+ type Expectation = Result < [ never , never ] , ( number | 'string' ) [ ] > ;
1207
1207
1208
1208
const result = Result . combineWithAllErrors ( [
1209
1209
err ( 1 ) ,
@@ -1224,10 +1224,20 @@ type CreateTuple<L, V = string> =
1224
1224
const assignablefromCheck : typeof result = assignableToCheck ;
1225
1225
} ) ;
1226
1226
1227
+ ( function it ( _ = 'combines arrays of different results to a result of an array' ) {
1228
+ type Expectation = Result < ( string | boolean ) [ ] , ( number | string ) [ ] > ;
1229
+ const results : ( Result < string , number > | Result < boolean , string > ) [ ] = [ ] ;
1230
+
1231
+ const result = Result . combineWithAllErrors ( results ) ;
1232
+
1233
+ const assignableToCheck : Expectation = result ;
1234
+ const assignablefromCheck : typeof result = assignableToCheck ;
1235
+ } ) ;
1236
+
1227
1237
( function describe ( _ = 'inference on large tuples' ) {
1228
1238
( function it ( _ = 'Should correctly infer the type on tuples with 6 elements' ) {
1229
1239
type Input = CreateTuple < 6 , Result < string , number > >
1230
- type Expectation = Result < CreateTuple < 6 , string > , CreateTuple < 6 , number > >
1240
+ type Expectation = Result < CreateTuple < 6 , string > , number [ ] >
1231
1241
1232
1242
const inputValues = input < Input > ( )
1233
1243
const result = Result . combineWithAllErrors ( inputValues )
@@ -1239,7 +1249,7 @@ type CreateTuple<L, V = string> =
1239
1249
1240
1250
( function it ( _ = 'Should correctly infer the type on tuples with 15 elements' ) {
1241
1251
type Input = CreateTuple < 15 , Result < string , number > >
1242
- type Expectation = Result < CreateTuple < 15 , string > , CreateTuple < 15 , number > >
1252
+ type Expectation = Result < CreateTuple < 15 , string > , number [ ] >
1243
1253
1244
1254
const inputValues = input < Input > ( )
1245
1255
const result = Result . combineWithAllErrors ( inputValues )
@@ -1251,7 +1261,7 @@ type CreateTuple<L, V = string> =
1251
1261
1252
1262
( function it ( _ = 'Should correctly infer the type on tuples with 30 elements' ) {
1253
1263
type Input = CreateTuple < 30 , Result < string , number > >
1254
- type Expectation = Result < CreateTuple < 30 , string > , CreateTuple < 30 , number > >
1264
+ type Expectation = Result < CreateTuple < 30 , string > , number [ ] >
1255
1265
1256
1266
const inputValues = input < Input > ( )
1257
1267
const result = Result . combineWithAllErrors ( inputValues )
@@ -1263,7 +1273,7 @@ type CreateTuple<L, V = string> =
1263
1273
1264
1274
( function it ( _ = 'Should correctly infer the type on tuples with 49 elements' ) {
1265
1275
type Input = CreateTuple < 49 , Result < string , number > >
1266
- type Expectation = Result < CreateTuple < 49 , string > , CreateTuple < 49 , number > >
1276
+ type Expectation = Result < CreateTuple < 49 , string > , number [ ] >
1267
1277
1268
1278
const inputValues = input < Input > ( )
1269
1279
const result = Result . combineWithAllErrors ( inputValues )
@@ -2199,7 +2209,7 @@ type CreateTuple<L, V = string> =
2199
2209
2200
2210
( function describe ( _ = 'combineWithAllErrors' ) {
2201
2211
( function it ( _ = 'combines different result asyncs into one' ) {
2202
- type Expectation = ResultAsync < [ number , string , never , never ] , [ never , never , string [ ] , Error ] > ;
2212
+ type Expectation = ResultAsync < [ number , string , never , never ] , ( string [ ] | Error ) [ ] > ;
2203
2213
2204
2214
const result = ResultAsync . combineWithAllErrors ( [
2205
2215
okAsync ( 1 ) ,
@@ -2213,7 +2223,7 @@ type CreateTuple<L, V = string> =
2213
2223
} ) ;
2214
2224
2215
2225
( function it ( _ = 'combines only ok result asyncs into one' ) {
2216
- type Expectation = ResultAsync < [ number , string ] , [ never , never ] > ;
2226
+ type Expectation = ResultAsync < [ number , string ] , never [ ] > ;
2217
2227
2218
2228
const result = ResultAsync . combineWithAllErrors ( [
2219
2229
okAsync ( 1 ) ,
@@ -2225,7 +2235,7 @@ type CreateTuple<L, V = string> =
2225
2235
} ) ;
2226
2236
2227
2237
( function it ( _ = 'combines only err result asyncs into one' ) {
2228
- type Expectation = ResultAsync < [ never , never ] , [ number , string ] > ;
2238
+ type Expectation = ResultAsync < [ never , never ] , ( number | string ) [ ] > ;
2229
2239
2230
2240
const result = ResultAsync . combineWithAllErrors ( [
2231
2241
errAsync ( 1 ) ,
@@ -2246,10 +2256,20 @@ type CreateTuple<L, V = string> =
2246
2256
const assignablefromCheck : typeof result = assignableToCheck ;
2247
2257
} ) ;
2248
2258
2259
+ ( function it ( _ = 'combines arrays of different result asyncs to a result of an array' ) {
2260
+ type Expectation = ResultAsync < ( string | boolean ) [ ] , ( number | string ) [ ] > ;
2261
+ const results : ( ResultAsync < string , number > | ResultAsync < boolean , string > ) [ ] = [ ] ;
2262
+
2263
+ const result = ResultAsync . combineWithAllErrors ( results ) ;
2264
+
2265
+ const assignableToCheck : Expectation = result ;
2266
+ const assignablefromCheck : typeof result = assignableToCheck ;
2267
+ } ) ;
2268
+
2249
2269
( function describe ( _ = 'inference on large tuples' ) {
2250
2270
( function it ( _ = 'Should correctly infer the type on tuples with 6 elements' ) {
2251
2271
type Input = CreateTuple < 6 , ResultAsync < string , number > >
2252
- type Expectation = ResultAsync < CreateTuple < 6 , string > , CreateTuple < 6 , number > >
2272
+ type Expectation = ResultAsync < CreateTuple < 6 , string > , number [ ] >
2253
2273
2254
2274
const inputValues = input < Input > ( )
2255
2275
const result = ResultAsync . combineWithAllErrors ( inputValues )
@@ -2261,7 +2281,7 @@ type CreateTuple<L, V = string> =
2261
2281
2262
2282
( function it ( _ = 'Should correctly infer the type on tuples with 15 elements' ) {
2263
2283
type Input = CreateTuple < 15 , ResultAsync < string , number > >
2264
- type Expectation = ResultAsync < CreateTuple < 15 , string > , CreateTuple < 15 , number > >
2284
+ type Expectation = ResultAsync < CreateTuple < 15 , string > , number [ ] >
2265
2285
2266
2286
const inputValues = input < Input > ( )
2267
2287
const result = ResultAsync . combineWithAllErrors ( inputValues )
@@ -2273,7 +2293,7 @@ type CreateTuple<L, V = string> =
2273
2293
2274
2294
( function it ( _ = 'Should correctly infer the type on tuples with 30 elements' ) {
2275
2295
type Input = CreateTuple < 30 , ResultAsync < string , number > >
2276
- type Expectation = ResultAsync < CreateTuple < 30 , string > , CreateTuple < 30 , number > >
2296
+ type Expectation = ResultAsync < CreateTuple < 30 , string > , number [ ] >
2277
2297
2278
2298
const inputValues = input < Input > ( )
2279
2299
const result = ResultAsync . combineWithAllErrors ( inputValues )
@@ -2285,7 +2305,7 @@ type CreateTuple<L, V = string> =
2285
2305
2286
2306
( function it ( _ = 'Should correctly infer the type on tuples with 49 elements' ) {
2287
2307
type Input = CreateTuple < 49 , ResultAsync < string , number > >
2288
- type Expectation = ResultAsync < CreateTuple < 49 , string > , CreateTuple < 49 , number > >
2308
+ type Expectation = ResultAsync < CreateTuple < 49 , string > , number [ ] >
2289
2309
2290
2310
const inputValues = input < Input > ( )
2291
2311
const result = ResultAsync . combineWithAllErrors ( inputValues )
0 commit comments