@eslint-react/shared 1.11.0 → 1.11.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +53 -340
- package/dist/index.d.ts +53 -340
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -165,294 +165,6 @@ declare function boolean(): BooleanSchema<undefined>;
|
|
|
165
165
|
*/
|
|
166
166
|
declare function boolean<const TMessage extends ErrorMessage<BooleanIssue> | undefined>(message: TMessage): BooleanSchema<TMessage>;
|
|
167
167
|
|
|
168
|
-
/**
|
|
169
|
-
* Lazy schema type.
|
|
170
|
-
*/
|
|
171
|
-
interface LazySchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>> extends BaseSchema<InferInput<TWrapped>, InferOutput<TWrapped>, InferIssue<TWrapped>> {
|
|
172
|
-
/**
|
|
173
|
-
* The schema type.
|
|
174
|
-
*/
|
|
175
|
-
readonly type: 'lazy';
|
|
176
|
-
/**
|
|
177
|
-
* The schema reference.
|
|
178
|
-
*/
|
|
179
|
-
readonly reference: typeof lazy;
|
|
180
|
-
/**
|
|
181
|
-
* The expected property.
|
|
182
|
-
*/
|
|
183
|
-
readonly expects: 'unknown';
|
|
184
|
-
/**
|
|
185
|
-
* The schema getter.
|
|
186
|
-
*/
|
|
187
|
-
readonly getter: (input: unknown) => TWrapped;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Creates a lazy schema.
|
|
191
|
-
*
|
|
192
|
-
* @param getter The schema getter.
|
|
193
|
-
*
|
|
194
|
-
* @returns A lazy schema.
|
|
195
|
-
*/
|
|
196
|
-
declare function lazy<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(getter: (input: unknown) => TWrapped): LazySchema<TWrapped>;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Lazy schema async type.
|
|
200
|
-
*/
|
|
201
|
-
interface LazySchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> extends BaseSchemaAsync<InferInput<TWrapped>, InferOutput<TWrapped>, InferIssue<TWrapped>> {
|
|
202
|
-
/**
|
|
203
|
-
* The schema type.
|
|
204
|
-
*/
|
|
205
|
-
readonly type: 'lazy';
|
|
206
|
-
/**
|
|
207
|
-
* The schema reference.
|
|
208
|
-
*/
|
|
209
|
-
readonly reference: typeof lazyAsync;
|
|
210
|
-
/**
|
|
211
|
-
* The expected property.
|
|
212
|
-
*/
|
|
213
|
-
readonly expects: 'unknown';
|
|
214
|
-
/**
|
|
215
|
-
* The schema getter.
|
|
216
|
-
*/
|
|
217
|
-
readonly getter: (input: unknown) => MaybePromise<TWrapped>;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Creates a lazy schema.
|
|
221
|
-
*
|
|
222
|
-
* @param getter The schema getter.
|
|
223
|
-
*
|
|
224
|
-
* @returns A lazy schema.
|
|
225
|
-
*/
|
|
226
|
-
declare function lazyAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(getter: (input: unknown) => MaybePromise<TWrapped>): LazySchemaAsync<TWrapped>;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Union issue type.
|
|
230
|
-
*/
|
|
231
|
-
interface UnionIssue<TSubIssue extends BaseIssue<unknown>> extends BaseIssue<unknown> {
|
|
232
|
-
/**
|
|
233
|
-
* The issue kind.
|
|
234
|
-
*/
|
|
235
|
-
readonly kind: 'schema';
|
|
236
|
-
/**
|
|
237
|
-
* The issue type.
|
|
238
|
-
*/
|
|
239
|
-
readonly type: 'union';
|
|
240
|
-
/**
|
|
241
|
-
* The expected property.
|
|
242
|
-
*/
|
|
243
|
-
readonly expected: string;
|
|
244
|
-
/**
|
|
245
|
-
* The sub issues.
|
|
246
|
-
*/
|
|
247
|
-
readonly issues?: [TSubIssue, ...TSubIssue[]];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Union options type.
|
|
252
|
-
*/
|
|
253
|
-
type UnionOptions = MaybeReadonly<BaseSchema<unknown, unknown, BaseIssue<unknown>>[]>;
|
|
254
|
-
/**
|
|
255
|
-
* Union schema type.
|
|
256
|
-
*/
|
|
257
|
-
interface UnionSchema<TOptions extends UnionOptions, TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined> extends BaseSchema<InferInput<TOptions[number]>, InferOutput<TOptions[number]>, UnionIssue<InferIssue<TOptions[number]>> | InferIssue<TOptions[number]>> {
|
|
258
|
-
/**
|
|
259
|
-
* The schema type.
|
|
260
|
-
*/
|
|
261
|
-
readonly type: 'union';
|
|
262
|
-
/**
|
|
263
|
-
* The schema reference.
|
|
264
|
-
*/
|
|
265
|
-
readonly reference: typeof union;
|
|
266
|
-
/**
|
|
267
|
-
* The union options.
|
|
268
|
-
*/
|
|
269
|
-
readonly options: TOptions;
|
|
270
|
-
/**
|
|
271
|
-
* The error message.
|
|
272
|
-
*/
|
|
273
|
-
readonly message: TMessage;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Creates an union schema.
|
|
277
|
-
*
|
|
278
|
-
* @param options The union options.
|
|
279
|
-
*
|
|
280
|
-
* @returns An union schema.
|
|
281
|
-
*/
|
|
282
|
-
declare function union<const TOptions extends UnionOptions>(options: TOptions): UnionSchema<TOptions, undefined>;
|
|
283
|
-
/**
|
|
284
|
-
* Creates an union schema.
|
|
285
|
-
*
|
|
286
|
-
* @param options The union options.
|
|
287
|
-
* @param message The error message.
|
|
288
|
-
*
|
|
289
|
-
* @returns An union schema.
|
|
290
|
-
*/
|
|
291
|
-
declare function union<const TOptions extends UnionOptions, const TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined>(options: TOptions, message: TMessage): UnionSchema<TOptions, TMessage>;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Union options async type.
|
|
295
|
-
*/
|
|
296
|
-
type UnionOptionsAsync = MaybeReadonly<(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>)[]>;
|
|
297
|
-
/**
|
|
298
|
-
* Union schema async type.
|
|
299
|
-
*/
|
|
300
|
-
interface UnionSchemaAsync<TOptions extends UnionOptionsAsync, TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined> extends BaseSchemaAsync<InferInput<TOptions[number]>, InferOutput<TOptions[number]>, UnionIssue<InferIssue<TOptions[number]>> | InferIssue<TOptions[number]>> {
|
|
301
|
-
/**
|
|
302
|
-
* The schema type.
|
|
303
|
-
*/
|
|
304
|
-
readonly type: 'union';
|
|
305
|
-
/**
|
|
306
|
-
* The schema reference.
|
|
307
|
-
*/
|
|
308
|
-
readonly reference: typeof unionAsync;
|
|
309
|
-
/**
|
|
310
|
-
* The union options.
|
|
311
|
-
*/
|
|
312
|
-
readonly options: TOptions;
|
|
313
|
-
/**
|
|
314
|
-
* The error message.
|
|
315
|
-
*/
|
|
316
|
-
readonly message: TMessage;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Creates an union schema.
|
|
320
|
-
*
|
|
321
|
-
* @param options The union options.
|
|
322
|
-
*
|
|
323
|
-
* @returns An union schema.
|
|
324
|
-
*/
|
|
325
|
-
declare function unionAsync<const TOptions extends UnionOptionsAsync>(options: TOptions): UnionSchemaAsync<TOptions, undefined>;
|
|
326
|
-
/**
|
|
327
|
-
* Creates an union schema.
|
|
328
|
-
*
|
|
329
|
-
* @param options The union options.
|
|
330
|
-
* @param message The error message.
|
|
331
|
-
*
|
|
332
|
-
* @returns An union schema.
|
|
333
|
-
*/
|
|
334
|
-
declare function unionAsync<const TOptions extends UnionOptionsAsync, const TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined>(options: TOptions, message: TMessage): UnionSchemaAsync<TOptions, TMessage>;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Non nullable issue type.
|
|
338
|
-
*/
|
|
339
|
-
interface NonNullableIssue extends BaseIssue<unknown> {
|
|
340
|
-
/**
|
|
341
|
-
* The issue kind.
|
|
342
|
-
*/
|
|
343
|
-
readonly kind: 'schema';
|
|
344
|
-
/**
|
|
345
|
-
* The issue type.
|
|
346
|
-
*/
|
|
347
|
-
readonly type: 'non_nullable';
|
|
348
|
-
/**
|
|
349
|
-
* The expected property.
|
|
350
|
-
*/
|
|
351
|
-
readonly expected: '!null';
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Infer non nullable input type.
|
|
355
|
-
*/
|
|
356
|
-
type InferNonNullableInput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = NonNullable$1<InferInput<TWrapped>>;
|
|
357
|
-
/**
|
|
358
|
-
* Infer non nullable output type.
|
|
359
|
-
*/
|
|
360
|
-
type InferNonNullableOutput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = NonNullable$1<InferOutput<TWrapped>>;
|
|
361
|
-
/**
|
|
362
|
-
* Infer non nullable issue type.
|
|
363
|
-
*/
|
|
364
|
-
type InferNonNullableIssue<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = TWrapped extends UnionSchema<UnionOptions, ErrorMessage<UnionIssue<BaseIssue<unknown>>> | undefined> | UnionSchemaAsync<UnionOptionsAsync, ErrorMessage<UnionIssue<BaseIssue<unknown>>> | undefined> ? Exclude<InferIssue<TWrapped>, {
|
|
365
|
-
type: 'null' | 'union';
|
|
366
|
-
}> | UnionIssue<InferNonNullableIssue<TWrapped['options'][number]>> : Exclude<InferIssue<TWrapped>, {
|
|
367
|
-
type: 'null';
|
|
368
|
-
}>;
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Non nullable schema type.
|
|
372
|
-
*/
|
|
373
|
-
interface NonNullableSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<NonNullableIssue> | undefined> extends BaseSchema<InferNonNullableInput<TWrapped>, InferNonNullableOutput<TWrapped>, NonNullableIssue | InferNonNullableIssue<TWrapped>> {
|
|
374
|
-
/**
|
|
375
|
-
* The schema type.
|
|
376
|
-
*/
|
|
377
|
-
readonly type: 'non_nullable';
|
|
378
|
-
/**
|
|
379
|
-
* The schema reference.
|
|
380
|
-
*/
|
|
381
|
-
readonly reference: typeof nonNullable;
|
|
382
|
-
/**
|
|
383
|
-
* The expected property.
|
|
384
|
-
*/
|
|
385
|
-
readonly expects: '!null';
|
|
386
|
-
/**
|
|
387
|
-
* The wrapped schema.
|
|
388
|
-
*/
|
|
389
|
-
readonly wrapped: TWrapped;
|
|
390
|
-
/**
|
|
391
|
-
* The error message.
|
|
392
|
-
*/
|
|
393
|
-
readonly message: TMessage;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Creates a non nullable schema.
|
|
397
|
-
*
|
|
398
|
-
* @param wrapped The wrapped schema.
|
|
399
|
-
*
|
|
400
|
-
* @returns A non nullable schema.
|
|
401
|
-
*/
|
|
402
|
-
declare function nonNullable<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): NonNullableSchema<TWrapped, undefined>;
|
|
403
|
-
/**
|
|
404
|
-
* Creates a non nullable schema.
|
|
405
|
-
*
|
|
406
|
-
* @param wrapped The wrapped schema.
|
|
407
|
-
* @param message The error message.
|
|
408
|
-
*
|
|
409
|
-
* @returns A non nullable schema.
|
|
410
|
-
*/
|
|
411
|
-
declare function nonNullable<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<NonNullableIssue> | undefined>(wrapped: TWrapped, message: TMessage): NonNullableSchema<TWrapped, TMessage>;
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Non nullable schema async type.
|
|
415
|
-
*/
|
|
416
|
-
interface NonNullableSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<NonNullableIssue> | undefined> extends BaseSchemaAsync<InferNonNullableInput<TWrapped>, InferNonNullableOutput<TWrapped>, NonNullableIssue | InferNonNullableIssue<TWrapped>> {
|
|
417
|
-
/**
|
|
418
|
-
* The schema type.
|
|
419
|
-
*/
|
|
420
|
-
readonly type: 'non_nullable';
|
|
421
|
-
/**
|
|
422
|
-
* The schema reference.
|
|
423
|
-
*/
|
|
424
|
-
readonly reference: typeof nonNullableAsync;
|
|
425
|
-
/**
|
|
426
|
-
* The expected property.
|
|
427
|
-
*/
|
|
428
|
-
readonly expects: '!null';
|
|
429
|
-
/**
|
|
430
|
-
* The wrapped schema.
|
|
431
|
-
*/
|
|
432
|
-
readonly wrapped: TWrapped;
|
|
433
|
-
/**
|
|
434
|
-
* The error message.
|
|
435
|
-
*/
|
|
436
|
-
readonly message: TMessage;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Creates a non nullable schema.
|
|
440
|
-
*
|
|
441
|
-
* @param wrapped The wrapped schema.
|
|
442
|
-
*
|
|
443
|
-
* @returns A non nullable schema.
|
|
444
|
-
*/
|
|
445
|
-
declare function nonNullableAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): NonNullableSchemaAsync<TWrapped, undefined>;
|
|
446
|
-
/**
|
|
447
|
-
* Creates a non nullable schema.
|
|
448
|
-
*
|
|
449
|
-
* @param wrapped The wrapped schema.
|
|
450
|
-
* @param message The error message.
|
|
451
|
-
*
|
|
452
|
-
* @returns A non nullable schema.
|
|
453
|
-
*/
|
|
454
|
-
declare function nonNullableAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<NonNullableIssue> | undefined>(wrapped: TWrapped, message: TMessage): NonNullableSchemaAsync<TWrapped, TMessage>;
|
|
455
|
-
|
|
456
168
|
/**
|
|
457
169
|
* Infer nullish output type.
|
|
458
170
|
*/
|
|
@@ -473,7 +185,7 @@ interface NullishSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<
|
|
|
473
185
|
/**
|
|
474
186
|
* The expected property.
|
|
475
187
|
*/
|
|
476
|
-
readonly expects:
|
|
188
|
+
readonly expects: `(${TWrapped['expects']} | null | undefined)`;
|
|
477
189
|
/**
|
|
478
190
|
* The wrapped schema.
|
|
479
191
|
*/
|
|
@@ -516,7 +228,7 @@ interface NullishSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseI
|
|
|
516
228
|
/**
|
|
517
229
|
* The expected property.
|
|
518
230
|
*/
|
|
519
|
-
readonly expects:
|
|
231
|
+
readonly expects: `(${TWrapped['expects']} | null | undefined)`;
|
|
520
232
|
/**
|
|
521
233
|
* The wrapped schema.
|
|
522
234
|
*/
|
|
@@ -635,7 +347,7 @@ interface OptionalSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue
|
|
|
635
347
|
/**
|
|
636
348
|
* The expected property.
|
|
637
349
|
*/
|
|
638
|
-
readonly expects:
|
|
350
|
+
readonly expects: `(${TWrapped['expects']} | undefined)`;
|
|
639
351
|
/**
|
|
640
352
|
* The wrapped schema.
|
|
641
353
|
*/
|
|
@@ -678,7 +390,7 @@ interface OptionalSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, Base
|
|
|
678
390
|
/**
|
|
679
391
|
* The expected property.
|
|
680
392
|
*/
|
|
681
|
-
readonly expects:
|
|
393
|
+
readonly expects: `(${TWrapped['expects']} | undefined)`;
|
|
682
394
|
/**
|
|
683
395
|
* The wrapped schema.
|
|
684
396
|
*/
|
|
@@ -711,7 +423,7 @@ declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknow
|
|
|
711
423
|
*/
|
|
712
424
|
type SchemaWithPipe<TPipe extends [
|
|
713
425
|
BaseSchema<unknown, unknown, BaseIssue<unknown>>,
|
|
714
|
-
...PipeItem<
|
|
426
|
+
...PipeItem<any, unknown, BaseIssue<unknown>>[]
|
|
715
427
|
]> = Omit<FirstTupleItem<TPipe>, '_run' | '_types'> & {
|
|
716
428
|
/**
|
|
717
429
|
* The pipe items.
|
|
@@ -727,7 +439,7 @@ type SchemaWithPipe<TPipe extends [
|
|
|
727
439
|
*
|
|
728
440
|
* @internal
|
|
729
441
|
*/
|
|
730
|
-
_run(dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>)
|
|
442
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>) => Dataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>;
|
|
731
443
|
/**
|
|
732
444
|
* Input, output and issue type.
|
|
733
445
|
*
|
|
@@ -745,7 +457,7 @@ type SchemaWithPipe<TPipe extends [
|
|
|
745
457
|
*/
|
|
746
458
|
type SchemaWithPipeAsync<TPipe extends [
|
|
747
459
|
(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>),
|
|
748
|
-
...(PipeItem<
|
|
460
|
+
...(PipeItem<any, unknown, BaseIssue<unknown>> | PipeItemAsync<any, unknown, BaseIssue<unknown>>)[]
|
|
749
461
|
]> = Omit<FirstTupleItem<TPipe>, 'async' | '_run' | '_types'> & {
|
|
750
462
|
/**
|
|
751
463
|
* The pipe items.
|
|
@@ -765,7 +477,7 @@ type SchemaWithPipeAsync<TPipe extends [
|
|
|
765
477
|
*
|
|
766
478
|
* @internal
|
|
767
479
|
*/
|
|
768
|
-
_run(dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>)
|
|
480
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>) => Promise<Dataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>>;
|
|
769
481
|
/**
|
|
770
482
|
* Input, output and issue type.
|
|
771
483
|
*
|
|
@@ -846,7 +558,7 @@ interface BaseMetadata<TInput> {
|
|
|
846
558
|
/**
|
|
847
559
|
* The metadata reference.
|
|
848
560
|
*/
|
|
849
|
-
readonly reference: (...args: any[]) => BaseMetadata<
|
|
561
|
+
readonly reference: (...args: any[]) => BaseMetadata<TInput>;
|
|
850
562
|
/**
|
|
851
563
|
* Input, output and issue type.
|
|
852
564
|
*
|
|
@@ -932,7 +644,7 @@ interface BaseSchema<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
932
644
|
*
|
|
933
645
|
* @internal
|
|
934
646
|
*/
|
|
935
|
-
_run(dataset: Dataset<unknown, never>, config: Config<TIssue>)
|
|
647
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<TIssue>) => Dataset<TOutput, TIssue>;
|
|
936
648
|
/**
|
|
937
649
|
* Input, output and issue type.
|
|
938
650
|
*
|
|
@@ -966,7 +678,7 @@ interface BaseSchemaAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> ex
|
|
|
966
678
|
*
|
|
967
679
|
* @internal
|
|
968
680
|
*/
|
|
969
|
-
_run(dataset: Dataset<unknown, never>, config: Config<TIssue>)
|
|
681
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<TIssue>) => Promise<Dataset<TOutput, TIssue>>;
|
|
970
682
|
}
|
|
971
683
|
|
|
972
684
|
/**
|
|
@@ -984,7 +696,7 @@ interface BaseTransformation<TInput, TOutput, TIssue extends BaseIssue<unknown>>
|
|
|
984
696
|
/**
|
|
985
697
|
* The transformation reference.
|
|
986
698
|
*/
|
|
987
|
-
readonly reference: (...args: any[]) => BaseTransformation<
|
|
699
|
+
readonly reference: (...args: any[]) => BaseTransformation<TInput, TOutput, TIssue>;
|
|
988
700
|
/**
|
|
989
701
|
* Whether it's async.
|
|
990
702
|
*/
|
|
@@ -999,7 +711,7 @@ interface BaseTransformation<TInput, TOutput, TIssue extends BaseIssue<unknown>>
|
|
|
999
711
|
*
|
|
1000
712
|
* @internal
|
|
1001
713
|
*/
|
|
1002
|
-
_run(dataset: TypedDataset<TInput, never>, config: Config<TIssue>)
|
|
714
|
+
readonly _run: (dataset: TypedDataset<TInput, never>, config: Config<TIssue>) => Dataset<TOutput, TIssue>;
|
|
1003
715
|
/**
|
|
1004
716
|
* Input, output and issue type.
|
|
1005
717
|
*
|
|
@@ -1018,7 +730,7 @@ interface BaseTransformationAsync<TInput, TOutput, TIssue extends BaseIssue<unkn
|
|
|
1018
730
|
/**
|
|
1019
731
|
* The transformation reference.
|
|
1020
732
|
*/
|
|
1021
|
-
readonly reference: (...args: any[]) => BaseTransformation<
|
|
733
|
+
readonly reference: (...args: any[]) => BaseTransformation<TInput, TOutput, TIssue> | BaseTransformationAsync<TInput, TOutput, TIssue>;
|
|
1022
734
|
/**
|
|
1023
735
|
* Whether it's async.
|
|
1024
736
|
*/
|
|
@@ -1033,7 +745,7 @@ interface BaseTransformationAsync<TInput, TOutput, TIssue extends BaseIssue<unkn
|
|
|
1033
745
|
*
|
|
1034
746
|
* @internal
|
|
1035
747
|
*/
|
|
1036
|
-
_run(dataset: TypedDataset<TInput, never>, config: Config<TIssue>)
|
|
748
|
+
readonly _run: (dataset: TypedDataset<TInput, never>, config: Config<TIssue>) => Promise<Dataset<TOutput, TIssue>>;
|
|
1037
749
|
}
|
|
1038
750
|
|
|
1039
751
|
/**
|
|
@@ -1051,7 +763,7 @@ interface BaseValidation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
1051
763
|
/**
|
|
1052
764
|
* The validation reference.
|
|
1053
765
|
*/
|
|
1054
|
-
readonly reference: (...args: any[]) => BaseValidation<
|
|
766
|
+
readonly reference: (...args: any[]) => BaseValidation<TInput, TOutput, TIssue>;
|
|
1055
767
|
/**
|
|
1056
768
|
* The expected property.
|
|
1057
769
|
*/
|
|
@@ -1070,7 +782,7 @@ interface BaseValidation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
1070
782
|
*
|
|
1071
783
|
* @internal
|
|
1072
784
|
*/
|
|
1073
|
-
_run(dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>)
|
|
785
|
+
readonly _run: (dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>) => Dataset<TOutput, BaseIssue<unknown> | TIssue>;
|
|
1074
786
|
/**
|
|
1075
787
|
* Input, output and issue type.
|
|
1076
788
|
*
|
|
@@ -1089,7 +801,7 @@ interface BaseValidationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>
|
|
|
1089
801
|
/**
|
|
1090
802
|
* The validation reference.
|
|
1091
803
|
*/
|
|
1092
|
-
readonly reference: (...args: any[]) => BaseValidation<
|
|
804
|
+
readonly reference: (...args: any[]) => BaseValidation<TInput, TOutput, TIssue> | BaseValidationAsync<TInput, TOutput, TIssue>;
|
|
1093
805
|
/**
|
|
1094
806
|
* Whether it's async.
|
|
1095
807
|
*/
|
|
@@ -1104,26 +816,21 @@ interface BaseValidationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>
|
|
|
1104
816
|
*
|
|
1105
817
|
* @internal
|
|
1106
818
|
*/
|
|
1107
|
-
_run(dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>)
|
|
819
|
+
readonly _run: (dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>) => Promise<Dataset<TOutput, BaseIssue<unknown> | TIssue>>;
|
|
1108
820
|
}
|
|
1109
821
|
|
|
1110
822
|
/**
|
|
1111
823
|
* Infer input type.
|
|
1112
824
|
*/
|
|
1113
|
-
type InferInput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<
|
|
825
|
+
type InferInput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['_types']>['input'];
|
|
1114
826
|
/**
|
|
1115
827
|
* Infer output type.
|
|
1116
828
|
*/
|
|
1117
|
-
type InferOutput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<
|
|
829
|
+
type InferOutput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['_types']>['output'];
|
|
1118
830
|
/**
|
|
1119
831
|
* Infer issue type.
|
|
1120
832
|
*/
|
|
1121
|
-
type InferIssue<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
* Extracts `null` from a type.
|
|
1125
|
-
*/
|
|
1126
|
-
type NonNullable$1<TValue> = TValue extends null ? never : TValue;
|
|
833
|
+
type InferIssue<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['_types']>['issue'];
|
|
1127
834
|
/**
|
|
1128
835
|
* Extracts `null` and `undefined` from a type.
|
|
1129
836
|
*/
|
|
@@ -1178,18 +885,6 @@ type DefaultAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknow
|
|
|
1178
885
|
* Default value type.
|
|
1179
886
|
*/
|
|
1180
887
|
type DefaultValue<TDefault extends Default<BaseSchema<unknown, unknown, BaseIssue<unknown>>, null | undefined> | DefaultAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, null | undefined>> = TDefault extends DefaultAsync<infer TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, infer TInput> ? TDefault extends (dataset?: Dataset<TInput, never>, config?: Config<InferIssue<TWrapped>>) => MaybePromise<InferInput<TWrapped> | TInput> ? Awaited<ReturnType<TDefault>> : TDefault : never;
|
|
1181
|
-
/**
|
|
1182
|
-
* Question mark schema type.
|
|
1183
|
-
*
|
|
1184
|
-
* TODO: Document that for simplicity and bundle size, we currently do not
|
|
1185
|
-
* distinguish between `undefined` and missing keys when using `optional` and
|
|
1186
|
-
* `nullish`.
|
|
1187
|
-
*/
|
|
1188
|
-
type QuestionMarkSchema = NullishSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | LazySchema<QuestionMarkSchema> | NonNullableSchema<QuestionMarkSchema, ErrorMessage<NonNullableIssue> | undefined>;
|
|
1189
|
-
/**
|
|
1190
|
-
* Question mark schema async type.
|
|
1191
|
-
*/
|
|
1192
|
-
type QuestionMarkSchemaAsync = NullishSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | LazySchemaAsync<QuestionMarkSchema | QuestionMarkSchemaAsync> | NonNullableSchemaAsync<QuestionMarkSchema | QuestionMarkSchemaAsync, ErrorMessage<NonNullableIssue> | undefined>;
|
|
1193
888
|
|
|
1194
889
|
/**
|
|
1195
890
|
* Pipe action type.
|
|
@@ -1233,39 +928,57 @@ type InferEntriesOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
|
1233
928
|
-readonly [TKey in keyof TEntries]: InferOutput<TEntries[TKey]>;
|
|
1234
929
|
};
|
|
1235
930
|
/**
|
|
1236
|
-
*
|
|
931
|
+
* Question mark schema type.
|
|
932
|
+
*
|
|
933
|
+
* TODO: Document that for simplicity and bundle size, we currently do not
|
|
934
|
+
* distinguish between `undefined` and missing keys when using `optional` and
|
|
935
|
+
* `nullish`.
|
|
1237
936
|
*/
|
|
1238
|
-
type
|
|
1239
|
-
|
|
937
|
+
type QuestionMarkSchema = NullishSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | NullishSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown>;
|
|
938
|
+
/**
|
|
939
|
+
* Optional input keys type.
|
|
940
|
+
*/
|
|
941
|
+
type OptionalInputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
942
|
+
[TKey in keyof TEntries]: TEntries[TKey] extends QuestionMarkSchema ? TKey : never;
|
|
943
|
+
}[keyof TEntries];
|
|
944
|
+
/**
|
|
945
|
+
* Optional output keys type.
|
|
946
|
+
*/
|
|
947
|
+
type OptionalOutputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
948
|
+
[TKey in keyof TEntries]: TEntries[TKey] extends QuestionMarkSchema ? [TEntries[TKey]['default']] extends [never] ? TKey : never : never;
|
|
1240
949
|
}[keyof TEntries];
|
|
1241
950
|
/**
|
|
1242
|
-
*
|
|
951
|
+
* Input with question marks type.
|
|
952
|
+
*/
|
|
953
|
+
type InputWithQuestionMarks<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesInput<TEntries> | InferEntriesOutput<TEntries>> = MarkOptional<TObject, OptionalInputKeys<TEntries>>;
|
|
954
|
+
/**
|
|
955
|
+
* Output with question marks type.
|
|
1243
956
|
*/
|
|
1244
|
-
type
|
|
957
|
+
type OutputWithQuestionMarks<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesInput<TEntries> | InferEntriesOutput<TEntries>> = MarkOptional<TObject, OptionalOutputKeys<TEntries>>;
|
|
1245
958
|
/**
|
|
1246
|
-
* Readonly keys type.
|
|
959
|
+
* Readonly output keys type.
|
|
1247
960
|
*/
|
|
1248
|
-
type
|
|
961
|
+
type ReadonlyOutputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
1249
962
|
[TKey in keyof TEntries]: TEntries[TKey] extends SchemaWithPipe<[
|
|
1250
963
|
BaseSchema<unknown, unknown, BaseIssue<unknown>>,
|
|
1251
|
-
...PipeItem<
|
|
964
|
+
...PipeItem<any, unknown, BaseIssue<unknown>>[]
|
|
1252
965
|
]> | SchemaWithPipeAsync<[
|
|
1253
966
|
(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>),
|
|
1254
|
-
...(PipeItem<
|
|
967
|
+
...(PipeItem<any, unknown, BaseIssue<unknown>> | PipeItemAsync<any, unknown, BaseIssue<unknown>>)[]
|
|
1255
968
|
]> ? 'readonly' extends TEntries[TKey]['pipe'][number]['type'] ? TKey : never : never;
|
|
1256
969
|
}[keyof TEntries];
|
|
1257
970
|
/**
|
|
1258
|
-
*
|
|
971
|
+
* Output with readonly type.
|
|
1259
972
|
*/
|
|
1260
|
-
type
|
|
973
|
+
type OutputWithReadonly<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends OutputWithQuestionMarks<TEntries, InferEntriesOutput<TEntries>>> = Readonly<TObject> & Pick<TObject, Exclude<keyof TObject, ReadonlyOutputKeys<TEntries>>>;
|
|
1261
974
|
/**
|
|
1262
975
|
* Infer object input type.
|
|
1263
976
|
*/
|
|
1264
|
-
type InferObjectInput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<
|
|
977
|
+
type InferObjectInput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<InputWithQuestionMarks<TEntries, InferEntriesInput<TEntries>>>;
|
|
1265
978
|
/**
|
|
1266
979
|
* Infer object output type.
|
|
1267
980
|
*/
|
|
1268
|
-
type InferObjectOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<
|
|
981
|
+
type InferObjectOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<OutputWithReadonly<TEntries, OutputWithQuestionMarks<TEntries, InferEntriesOutput<TEntries>>>>;
|
|
1269
982
|
/**
|
|
1270
983
|
* Infer object issue type.
|
|
1271
984
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -165,294 +165,6 @@ declare function boolean(): BooleanSchema<undefined>;
|
|
|
165
165
|
*/
|
|
166
166
|
declare function boolean<const TMessage extends ErrorMessage<BooleanIssue> | undefined>(message: TMessage): BooleanSchema<TMessage>;
|
|
167
167
|
|
|
168
|
-
/**
|
|
169
|
-
* Lazy schema type.
|
|
170
|
-
*/
|
|
171
|
-
interface LazySchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>> extends BaseSchema<InferInput<TWrapped>, InferOutput<TWrapped>, InferIssue<TWrapped>> {
|
|
172
|
-
/**
|
|
173
|
-
* The schema type.
|
|
174
|
-
*/
|
|
175
|
-
readonly type: 'lazy';
|
|
176
|
-
/**
|
|
177
|
-
* The schema reference.
|
|
178
|
-
*/
|
|
179
|
-
readonly reference: typeof lazy;
|
|
180
|
-
/**
|
|
181
|
-
* The expected property.
|
|
182
|
-
*/
|
|
183
|
-
readonly expects: 'unknown';
|
|
184
|
-
/**
|
|
185
|
-
* The schema getter.
|
|
186
|
-
*/
|
|
187
|
-
readonly getter: (input: unknown) => TWrapped;
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Creates a lazy schema.
|
|
191
|
-
*
|
|
192
|
-
* @param getter The schema getter.
|
|
193
|
-
*
|
|
194
|
-
* @returns A lazy schema.
|
|
195
|
-
*/
|
|
196
|
-
declare function lazy<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(getter: (input: unknown) => TWrapped): LazySchema<TWrapped>;
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Lazy schema async type.
|
|
200
|
-
*/
|
|
201
|
-
interface LazySchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> extends BaseSchemaAsync<InferInput<TWrapped>, InferOutput<TWrapped>, InferIssue<TWrapped>> {
|
|
202
|
-
/**
|
|
203
|
-
* The schema type.
|
|
204
|
-
*/
|
|
205
|
-
readonly type: 'lazy';
|
|
206
|
-
/**
|
|
207
|
-
* The schema reference.
|
|
208
|
-
*/
|
|
209
|
-
readonly reference: typeof lazyAsync;
|
|
210
|
-
/**
|
|
211
|
-
* The expected property.
|
|
212
|
-
*/
|
|
213
|
-
readonly expects: 'unknown';
|
|
214
|
-
/**
|
|
215
|
-
* The schema getter.
|
|
216
|
-
*/
|
|
217
|
-
readonly getter: (input: unknown) => MaybePromise<TWrapped>;
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Creates a lazy schema.
|
|
221
|
-
*
|
|
222
|
-
* @param getter The schema getter.
|
|
223
|
-
*
|
|
224
|
-
* @returns A lazy schema.
|
|
225
|
-
*/
|
|
226
|
-
declare function lazyAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(getter: (input: unknown) => MaybePromise<TWrapped>): LazySchemaAsync<TWrapped>;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Union issue type.
|
|
230
|
-
*/
|
|
231
|
-
interface UnionIssue<TSubIssue extends BaseIssue<unknown>> extends BaseIssue<unknown> {
|
|
232
|
-
/**
|
|
233
|
-
* The issue kind.
|
|
234
|
-
*/
|
|
235
|
-
readonly kind: 'schema';
|
|
236
|
-
/**
|
|
237
|
-
* The issue type.
|
|
238
|
-
*/
|
|
239
|
-
readonly type: 'union';
|
|
240
|
-
/**
|
|
241
|
-
* The expected property.
|
|
242
|
-
*/
|
|
243
|
-
readonly expected: string;
|
|
244
|
-
/**
|
|
245
|
-
* The sub issues.
|
|
246
|
-
*/
|
|
247
|
-
readonly issues?: [TSubIssue, ...TSubIssue[]];
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Union options type.
|
|
252
|
-
*/
|
|
253
|
-
type UnionOptions = MaybeReadonly<BaseSchema<unknown, unknown, BaseIssue<unknown>>[]>;
|
|
254
|
-
/**
|
|
255
|
-
* Union schema type.
|
|
256
|
-
*/
|
|
257
|
-
interface UnionSchema<TOptions extends UnionOptions, TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined> extends BaseSchema<InferInput<TOptions[number]>, InferOutput<TOptions[number]>, UnionIssue<InferIssue<TOptions[number]>> | InferIssue<TOptions[number]>> {
|
|
258
|
-
/**
|
|
259
|
-
* The schema type.
|
|
260
|
-
*/
|
|
261
|
-
readonly type: 'union';
|
|
262
|
-
/**
|
|
263
|
-
* The schema reference.
|
|
264
|
-
*/
|
|
265
|
-
readonly reference: typeof union;
|
|
266
|
-
/**
|
|
267
|
-
* The union options.
|
|
268
|
-
*/
|
|
269
|
-
readonly options: TOptions;
|
|
270
|
-
/**
|
|
271
|
-
* The error message.
|
|
272
|
-
*/
|
|
273
|
-
readonly message: TMessage;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Creates an union schema.
|
|
277
|
-
*
|
|
278
|
-
* @param options The union options.
|
|
279
|
-
*
|
|
280
|
-
* @returns An union schema.
|
|
281
|
-
*/
|
|
282
|
-
declare function union<const TOptions extends UnionOptions>(options: TOptions): UnionSchema<TOptions, undefined>;
|
|
283
|
-
/**
|
|
284
|
-
* Creates an union schema.
|
|
285
|
-
*
|
|
286
|
-
* @param options The union options.
|
|
287
|
-
* @param message The error message.
|
|
288
|
-
*
|
|
289
|
-
* @returns An union schema.
|
|
290
|
-
*/
|
|
291
|
-
declare function union<const TOptions extends UnionOptions, const TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined>(options: TOptions, message: TMessage): UnionSchema<TOptions, TMessage>;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Union options async type.
|
|
295
|
-
*/
|
|
296
|
-
type UnionOptionsAsync = MaybeReadonly<(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>)[]>;
|
|
297
|
-
/**
|
|
298
|
-
* Union schema async type.
|
|
299
|
-
*/
|
|
300
|
-
interface UnionSchemaAsync<TOptions extends UnionOptionsAsync, TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined> extends BaseSchemaAsync<InferInput<TOptions[number]>, InferOutput<TOptions[number]>, UnionIssue<InferIssue<TOptions[number]>> | InferIssue<TOptions[number]>> {
|
|
301
|
-
/**
|
|
302
|
-
* The schema type.
|
|
303
|
-
*/
|
|
304
|
-
readonly type: 'union';
|
|
305
|
-
/**
|
|
306
|
-
* The schema reference.
|
|
307
|
-
*/
|
|
308
|
-
readonly reference: typeof unionAsync;
|
|
309
|
-
/**
|
|
310
|
-
* The union options.
|
|
311
|
-
*/
|
|
312
|
-
readonly options: TOptions;
|
|
313
|
-
/**
|
|
314
|
-
* The error message.
|
|
315
|
-
*/
|
|
316
|
-
readonly message: TMessage;
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* Creates an union schema.
|
|
320
|
-
*
|
|
321
|
-
* @param options The union options.
|
|
322
|
-
*
|
|
323
|
-
* @returns An union schema.
|
|
324
|
-
*/
|
|
325
|
-
declare function unionAsync<const TOptions extends UnionOptionsAsync>(options: TOptions): UnionSchemaAsync<TOptions, undefined>;
|
|
326
|
-
/**
|
|
327
|
-
* Creates an union schema.
|
|
328
|
-
*
|
|
329
|
-
* @param options The union options.
|
|
330
|
-
* @param message The error message.
|
|
331
|
-
*
|
|
332
|
-
* @returns An union schema.
|
|
333
|
-
*/
|
|
334
|
-
declare function unionAsync<const TOptions extends UnionOptionsAsync, const TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined>(options: TOptions, message: TMessage): UnionSchemaAsync<TOptions, TMessage>;
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Non nullable issue type.
|
|
338
|
-
*/
|
|
339
|
-
interface NonNullableIssue extends BaseIssue<unknown> {
|
|
340
|
-
/**
|
|
341
|
-
* The issue kind.
|
|
342
|
-
*/
|
|
343
|
-
readonly kind: 'schema';
|
|
344
|
-
/**
|
|
345
|
-
* The issue type.
|
|
346
|
-
*/
|
|
347
|
-
readonly type: 'non_nullable';
|
|
348
|
-
/**
|
|
349
|
-
* The expected property.
|
|
350
|
-
*/
|
|
351
|
-
readonly expected: '!null';
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Infer non nullable input type.
|
|
355
|
-
*/
|
|
356
|
-
type InferNonNullableInput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = NonNullable$1<InferInput<TWrapped>>;
|
|
357
|
-
/**
|
|
358
|
-
* Infer non nullable output type.
|
|
359
|
-
*/
|
|
360
|
-
type InferNonNullableOutput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = NonNullable$1<InferOutput<TWrapped>>;
|
|
361
|
-
/**
|
|
362
|
-
* Infer non nullable issue type.
|
|
363
|
-
*/
|
|
364
|
-
type InferNonNullableIssue<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = TWrapped extends UnionSchema<UnionOptions, ErrorMessage<UnionIssue<BaseIssue<unknown>>> | undefined> | UnionSchemaAsync<UnionOptionsAsync, ErrorMessage<UnionIssue<BaseIssue<unknown>>> | undefined> ? Exclude<InferIssue<TWrapped>, {
|
|
365
|
-
type: 'null' | 'union';
|
|
366
|
-
}> | UnionIssue<InferNonNullableIssue<TWrapped['options'][number]>> : Exclude<InferIssue<TWrapped>, {
|
|
367
|
-
type: 'null';
|
|
368
|
-
}>;
|
|
369
|
-
|
|
370
|
-
/**
|
|
371
|
-
* Non nullable schema type.
|
|
372
|
-
*/
|
|
373
|
-
interface NonNullableSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<NonNullableIssue> | undefined> extends BaseSchema<InferNonNullableInput<TWrapped>, InferNonNullableOutput<TWrapped>, NonNullableIssue | InferNonNullableIssue<TWrapped>> {
|
|
374
|
-
/**
|
|
375
|
-
* The schema type.
|
|
376
|
-
*/
|
|
377
|
-
readonly type: 'non_nullable';
|
|
378
|
-
/**
|
|
379
|
-
* The schema reference.
|
|
380
|
-
*/
|
|
381
|
-
readonly reference: typeof nonNullable;
|
|
382
|
-
/**
|
|
383
|
-
* The expected property.
|
|
384
|
-
*/
|
|
385
|
-
readonly expects: '!null';
|
|
386
|
-
/**
|
|
387
|
-
* The wrapped schema.
|
|
388
|
-
*/
|
|
389
|
-
readonly wrapped: TWrapped;
|
|
390
|
-
/**
|
|
391
|
-
* The error message.
|
|
392
|
-
*/
|
|
393
|
-
readonly message: TMessage;
|
|
394
|
-
}
|
|
395
|
-
/**
|
|
396
|
-
* Creates a non nullable schema.
|
|
397
|
-
*
|
|
398
|
-
* @param wrapped The wrapped schema.
|
|
399
|
-
*
|
|
400
|
-
* @returns A non nullable schema.
|
|
401
|
-
*/
|
|
402
|
-
declare function nonNullable<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): NonNullableSchema<TWrapped, undefined>;
|
|
403
|
-
/**
|
|
404
|
-
* Creates a non nullable schema.
|
|
405
|
-
*
|
|
406
|
-
* @param wrapped The wrapped schema.
|
|
407
|
-
* @param message The error message.
|
|
408
|
-
*
|
|
409
|
-
* @returns A non nullable schema.
|
|
410
|
-
*/
|
|
411
|
-
declare function nonNullable<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<NonNullableIssue> | undefined>(wrapped: TWrapped, message: TMessage): NonNullableSchema<TWrapped, TMessage>;
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Non nullable schema async type.
|
|
415
|
-
*/
|
|
416
|
-
interface NonNullableSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<NonNullableIssue> | undefined> extends BaseSchemaAsync<InferNonNullableInput<TWrapped>, InferNonNullableOutput<TWrapped>, NonNullableIssue | InferNonNullableIssue<TWrapped>> {
|
|
417
|
-
/**
|
|
418
|
-
* The schema type.
|
|
419
|
-
*/
|
|
420
|
-
readonly type: 'non_nullable';
|
|
421
|
-
/**
|
|
422
|
-
* The schema reference.
|
|
423
|
-
*/
|
|
424
|
-
readonly reference: typeof nonNullableAsync;
|
|
425
|
-
/**
|
|
426
|
-
* The expected property.
|
|
427
|
-
*/
|
|
428
|
-
readonly expects: '!null';
|
|
429
|
-
/**
|
|
430
|
-
* The wrapped schema.
|
|
431
|
-
*/
|
|
432
|
-
readonly wrapped: TWrapped;
|
|
433
|
-
/**
|
|
434
|
-
* The error message.
|
|
435
|
-
*/
|
|
436
|
-
readonly message: TMessage;
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Creates a non nullable schema.
|
|
440
|
-
*
|
|
441
|
-
* @param wrapped The wrapped schema.
|
|
442
|
-
*
|
|
443
|
-
* @returns A non nullable schema.
|
|
444
|
-
*/
|
|
445
|
-
declare function nonNullableAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): NonNullableSchemaAsync<TWrapped, undefined>;
|
|
446
|
-
/**
|
|
447
|
-
* Creates a non nullable schema.
|
|
448
|
-
*
|
|
449
|
-
* @param wrapped The wrapped schema.
|
|
450
|
-
* @param message The error message.
|
|
451
|
-
*
|
|
452
|
-
* @returns A non nullable schema.
|
|
453
|
-
*/
|
|
454
|
-
declare function nonNullableAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<NonNullableIssue> | undefined>(wrapped: TWrapped, message: TMessage): NonNullableSchemaAsync<TWrapped, TMessage>;
|
|
455
|
-
|
|
456
168
|
/**
|
|
457
169
|
* Infer nullish output type.
|
|
458
170
|
*/
|
|
@@ -473,7 +185,7 @@ interface NullishSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<
|
|
|
473
185
|
/**
|
|
474
186
|
* The expected property.
|
|
475
187
|
*/
|
|
476
|
-
readonly expects:
|
|
188
|
+
readonly expects: `(${TWrapped['expects']} | null | undefined)`;
|
|
477
189
|
/**
|
|
478
190
|
* The wrapped schema.
|
|
479
191
|
*/
|
|
@@ -516,7 +228,7 @@ interface NullishSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseI
|
|
|
516
228
|
/**
|
|
517
229
|
* The expected property.
|
|
518
230
|
*/
|
|
519
|
-
readonly expects:
|
|
231
|
+
readonly expects: `(${TWrapped['expects']} | null | undefined)`;
|
|
520
232
|
/**
|
|
521
233
|
* The wrapped schema.
|
|
522
234
|
*/
|
|
@@ -635,7 +347,7 @@ interface OptionalSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue
|
|
|
635
347
|
/**
|
|
636
348
|
* The expected property.
|
|
637
349
|
*/
|
|
638
|
-
readonly expects:
|
|
350
|
+
readonly expects: `(${TWrapped['expects']} | undefined)`;
|
|
639
351
|
/**
|
|
640
352
|
* The wrapped schema.
|
|
641
353
|
*/
|
|
@@ -678,7 +390,7 @@ interface OptionalSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, Base
|
|
|
678
390
|
/**
|
|
679
391
|
* The expected property.
|
|
680
392
|
*/
|
|
681
|
-
readonly expects:
|
|
393
|
+
readonly expects: `(${TWrapped['expects']} | undefined)`;
|
|
682
394
|
/**
|
|
683
395
|
* The wrapped schema.
|
|
684
396
|
*/
|
|
@@ -711,7 +423,7 @@ declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknow
|
|
|
711
423
|
*/
|
|
712
424
|
type SchemaWithPipe<TPipe extends [
|
|
713
425
|
BaseSchema<unknown, unknown, BaseIssue<unknown>>,
|
|
714
|
-
...PipeItem<
|
|
426
|
+
...PipeItem<any, unknown, BaseIssue<unknown>>[]
|
|
715
427
|
]> = Omit<FirstTupleItem<TPipe>, '_run' | '_types'> & {
|
|
716
428
|
/**
|
|
717
429
|
* The pipe items.
|
|
@@ -727,7 +439,7 @@ type SchemaWithPipe<TPipe extends [
|
|
|
727
439
|
*
|
|
728
440
|
* @internal
|
|
729
441
|
*/
|
|
730
|
-
_run(dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>)
|
|
442
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>) => Dataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>;
|
|
731
443
|
/**
|
|
732
444
|
* Input, output and issue type.
|
|
733
445
|
*
|
|
@@ -745,7 +457,7 @@ type SchemaWithPipe<TPipe extends [
|
|
|
745
457
|
*/
|
|
746
458
|
type SchemaWithPipeAsync<TPipe extends [
|
|
747
459
|
(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>),
|
|
748
|
-
...(PipeItem<
|
|
460
|
+
...(PipeItem<any, unknown, BaseIssue<unknown>> | PipeItemAsync<any, unknown, BaseIssue<unknown>>)[]
|
|
749
461
|
]> = Omit<FirstTupleItem<TPipe>, 'async' | '_run' | '_types'> & {
|
|
750
462
|
/**
|
|
751
463
|
* The pipe items.
|
|
@@ -765,7 +477,7 @@ type SchemaWithPipeAsync<TPipe extends [
|
|
|
765
477
|
*
|
|
766
478
|
* @internal
|
|
767
479
|
*/
|
|
768
|
-
_run(dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>)
|
|
480
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<InferIssue<FirstTupleItem<TPipe>>>) => Promise<Dataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>>;
|
|
769
481
|
/**
|
|
770
482
|
* Input, output and issue type.
|
|
771
483
|
*
|
|
@@ -846,7 +558,7 @@ interface BaseMetadata<TInput> {
|
|
|
846
558
|
/**
|
|
847
559
|
* The metadata reference.
|
|
848
560
|
*/
|
|
849
|
-
readonly reference: (...args: any[]) => BaseMetadata<
|
|
561
|
+
readonly reference: (...args: any[]) => BaseMetadata<TInput>;
|
|
850
562
|
/**
|
|
851
563
|
* Input, output and issue type.
|
|
852
564
|
*
|
|
@@ -932,7 +644,7 @@ interface BaseSchema<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
932
644
|
*
|
|
933
645
|
* @internal
|
|
934
646
|
*/
|
|
935
|
-
_run(dataset: Dataset<unknown, never>, config: Config<TIssue>)
|
|
647
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<TIssue>) => Dataset<TOutput, TIssue>;
|
|
936
648
|
/**
|
|
937
649
|
* Input, output and issue type.
|
|
938
650
|
*
|
|
@@ -966,7 +678,7 @@ interface BaseSchemaAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> ex
|
|
|
966
678
|
*
|
|
967
679
|
* @internal
|
|
968
680
|
*/
|
|
969
|
-
_run(dataset: Dataset<unknown, never>, config: Config<TIssue>)
|
|
681
|
+
readonly _run: (dataset: Dataset<unknown, never>, config: Config<TIssue>) => Promise<Dataset<TOutput, TIssue>>;
|
|
970
682
|
}
|
|
971
683
|
|
|
972
684
|
/**
|
|
@@ -984,7 +696,7 @@ interface BaseTransformation<TInput, TOutput, TIssue extends BaseIssue<unknown>>
|
|
|
984
696
|
/**
|
|
985
697
|
* The transformation reference.
|
|
986
698
|
*/
|
|
987
|
-
readonly reference: (...args: any[]) => BaseTransformation<
|
|
699
|
+
readonly reference: (...args: any[]) => BaseTransformation<TInput, TOutput, TIssue>;
|
|
988
700
|
/**
|
|
989
701
|
* Whether it's async.
|
|
990
702
|
*/
|
|
@@ -999,7 +711,7 @@ interface BaseTransformation<TInput, TOutput, TIssue extends BaseIssue<unknown>>
|
|
|
999
711
|
*
|
|
1000
712
|
* @internal
|
|
1001
713
|
*/
|
|
1002
|
-
_run(dataset: TypedDataset<TInput, never>, config: Config<TIssue>)
|
|
714
|
+
readonly _run: (dataset: TypedDataset<TInput, never>, config: Config<TIssue>) => Dataset<TOutput, TIssue>;
|
|
1003
715
|
/**
|
|
1004
716
|
* Input, output and issue type.
|
|
1005
717
|
*
|
|
@@ -1018,7 +730,7 @@ interface BaseTransformationAsync<TInput, TOutput, TIssue extends BaseIssue<unkn
|
|
|
1018
730
|
/**
|
|
1019
731
|
* The transformation reference.
|
|
1020
732
|
*/
|
|
1021
|
-
readonly reference: (...args: any[]) => BaseTransformation<
|
|
733
|
+
readonly reference: (...args: any[]) => BaseTransformation<TInput, TOutput, TIssue> | BaseTransformationAsync<TInput, TOutput, TIssue>;
|
|
1022
734
|
/**
|
|
1023
735
|
* Whether it's async.
|
|
1024
736
|
*/
|
|
@@ -1033,7 +745,7 @@ interface BaseTransformationAsync<TInput, TOutput, TIssue extends BaseIssue<unkn
|
|
|
1033
745
|
*
|
|
1034
746
|
* @internal
|
|
1035
747
|
*/
|
|
1036
|
-
_run(dataset: TypedDataset<TInput, never>, config: Config<TIssue>)
|
|
748
|
+
readonly _run: (dataset: TypedDataset<TInput, never>, config: Config<TIssue>) => Promise<Dataset<TOutput, TIssue>>;
|
|
1037
749
|
}
|
|
1038
750
|
|
|
1039
751
|
/**
|
|
@@ -1051,7 +763,7 @@ interface BaseValidation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
1051
763
|
/**
|
|
1052
764
|
* The validation reference.
|
|
1053
765
|
*/
|
|
1054
|
-
readonly reference: (...args: any[]) => BaseValidation<
|
|
766
|
+
readonly reference: (...args: any[]) => BaseValidation<TInput, TOutput, TIssue>;
|
|
1055
767
|
/**
|
|
1056
768
|
* The expected property.
|
|
1057
769
|
*/
|
|
@@ -1070,7 +782,7 @@ interface BaseValidation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
|
|
|
1070
782
|
*
|
|
1071
783
|
* @internal
|
|
1072
784
|
*/
|
|
1073
|
-
_run(dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>)
|
|
785
|
+
readonly _run: (dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>) => Dataset<TOutput, BaseIssue<unknown> | TIssue>;
|
|
1074
786
|
/**
|
|
1075
787
|
* Input, output and issue type.
|
|
1076
788
|
*
|
|
@@ -1089,7 +801,7 @@ interface BaseValidationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>
|
|
|
1089
801
|
/**
|
|
1090
802
|
* The validation reference.
|
|
1091
803
|
*/
|
|
1092
|
-
readonly reference: (...args: any[]) => BaseValidation<
|
|
804
|
+
readonly reference: (...args: any[]) => BaseValidation<TInput, TOutput, TIssue> | BaseValidationAsync<TInput, TOutput, TIssue>;
|
|
1093
805
|
/**
|
|
1094
806
|
* Whether it's async.
|
|
1095
807
|
*/
|
|
@@ -1104,26 +816,21 @@ interface BaseValidationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>
|
|
|
1104
816
|
*
|
|
1105
817
|
* @internal
|
|
1106
818
|
*/
|
|
1107
|
-
_run(dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>)
|
|
819
|
+
readonly _run: (dataset: Dataset<TInput, BaseIssue<unknown>>, config: Config<TIssue>) => Promise<Dataset<TOutput, BaseIssue<unknown> | TIssue>>;
|
|
1108
820
|
}
|
|
1109
821
|
|
|
1110
822
|
/**
|
|
1111
823
|
* Infer input type.
|
|
1112
824
|
*/
|
|
1113
|
-
type InferInput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<
|
|
825
|
+
type InferInput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['_types']>['input'];
|
|
1114
826
|
/**
|
|
1115
827
|
* Infer output type.
|
|
1116
828
|
*/
|
|
1117
|
-
type InferOutput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<
|
|
829
|
+
type InferOutput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['_types']>['output'];
|
|
1118
830
|
/**
|
|
1119
831
|
* Infer issue type.
|
|
1120
832
|
*/
|
|
1121
|
-
type InferIssue<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<
|
|
1122
|
-
|
|
1123
|
-
/**
|
|
1124
|
-
* Extracts `null` from a type.
|
|
1125
|
-
*/
|
|
1126
|
-
type NonNullable$1<TValue> = TValue extends null ? never : TValue;
|
|
833
|
+
type InferIssue<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['_types']>['issue'];
|
|
1127
834
|
/**
|
|
1128
835
|
* Extracts `null` and `undefined` from a type.
|
|
1129
836
|
*/
|
|
@@ -1178,18 +885,6 @@ type DefaultAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknow
|
|
|
1178
885
|
* Default value type.
|
|
1179
886
|
*/
|
|
1180
887
|
type DefaultValue<TDefault extends Default<BaseSchema<unknown, unknown, BaseIssue<unknown>>, null | undefined> | DefaultAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, null | undefined>> = TDefault extends DefaultAsync<infer TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, infer TInput> ? TDefault extends (dataset?: Dataset<TInput, never>, config?: Config<InferIssue<TWrapped>>) => MaybePromise<InferInput<TWrapped> | TInput> ? Awaited<ReturnType<TDefault>> : TDefault : never;
|
|
1181
|
-
/**
|
|
1182
|
-
* Question mark schema type.
|
|
1183
|
-
*
|
|
1184
|
-
* TODO: Document that for simplicity and bundle size, we currently do not
|
|
1185
|
-
* distinguish between `undefined` and missing keys when using `optional` and
|
|
1186
|
-
* `nullish`.
|
|
1187
|
-
*/
|
|
1188
|
-
type QuestionMarkSchema = NullishSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | LazySchema<QuestionMarkSchema> | NonNullableSchema<QuestionMarkSchema, ErrorMessage<NonNullableIssue> | undefined>;
|
|
1189
|
-
/**
|
|
1190
|
-
* Question mark schema async type.
|
|
1191
|
-
*/
|
|
1192
|
-
type QuestionMarkSchemaAsync = NullishSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | LazySchemaAsync<QuestionMarkSchema | QuestionMarkSchemaAsync> | NonNullableSchemaAsync<QuestionMarkSchema | QuestionMarkSchemaAsync, ErrorMessage<NonNullableIssue> | undefined>;
|
|
1193
888
|
|
|
1194
889
|
/**
|
|
1195
890
|
* Pipe action type.
|
|
@@ -1233,39 +928,57 @@ type InferEntriesOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
|
1233
928
|
-readonly [TKey in keyof TEntries]: InferOutput<TEntries[TKey]>;
|
|
1234
929
|
};
|
|
1235
930
|
/**
|
|
1236
|
-
*
|
|
931
|
+
* Question mark schema type.
|
|
932
|
+
*
|
|
933
|
+
* TODO: Document that for simplicity and bundle size, we currently do not
|
|
934
|
+
* distinguish between `undefined` and missing keys when using `optional` and
|
|
935
|
+
* `nullish`.
|
|
1237
936
|
*/
|
|
1238
|
-
type
|
|
1239
|
-
|
|
937
|
+
type QuestionMarkSchema = NullishSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | NullishSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown>;
|
|
938
|
+
/**
|
|
939
|
+
* Optional input keys type.
|
|
940
|
+
*/
|
|
941
|
+
type OptionalInputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
942
|
+
[TKey in keyof TEntries]: TEntries[TKey] extends QuestionMarkSchema ? TKey : never;
|
|
943
|
+
}[keyof TEntries];
|
|
944
|
+
/**
|
|
945
|
+
* Optional output keys type.
|
|
946
|
+
*/
|
|
947
|
+
type OptionalOutputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
948
|
+
[TKey in keyof TEntries]: TEntries[TKey] extends QuestionMarkSchema ? [TEntries[TKey]['default']] extends [never] ? TKey : never : never;
|
|
1240
949
|
}[keyof TEntries];
|
|
1241
950
|
/**
|
|
1242
|
-
*
|
|
951
|
+
* Input with question marks type.
|
|
952
|
+
*/
|
|
953
|
+
type InputWithQuestionMarks<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesInput<TEntries> | InferEntriesOutput<TEntries>> = MarkOptional<TObject, OptionalInputKeys<TEntries>>;
|
|
954
|
+
/**
|
|
955
|
+
* Output with question marks type.
|
|
1243
956
|
*/
|
|
1244
|
-
type
|
|
957
|
+
type OutputWithQuestionMarks<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesInput<TEntries> | InferEntriesOutput<TEntries>> = MarkOptional<TObject, OptionalOutputKeys<TEntries>>;
|
|
1245
958
|
/**
|
|
1246
|
-
* Readonly keys type.
|
|
959
|
+
* Readonly output keys type.
|
|
1247
960
|
*/
|
|
1248
|
-
type
|
|
961
|
+
type ReadonlyOutputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = {
|
|
1249
962
|
[TKey in keyof TEntries]: TEntries[TKey] extends SchemaWithPipe<[
|
|
1250
963
|
BaseSchema<unknown, unknown, BaseIssue<unknown>>,
|
|
1251
|
-
...PipeItem<
|
|
964
|
+
...PipeItem<any, unknown, BaseIssue<unknown>>[]
|
|
1252
965
|
]> | SchemaWithPipeAsync<[
|
|
1253
966
|
(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>),
|
|
1254
|
-
...(PipeItem<
|
|
967
|
+
...(PipeItem<any, unknown, BaseIssue<unknown>> | PipeItemAsync<any, unknown, BaseIssue<unknown>>)[]
|
|
1255
968
|
]> ? 'readonly' extends TEntries[TKey]['pipe'][number]['type'] ? TKey : never : never;
|
|
1256
969
|
}[keyof TEntries];
|
|
1257
970
|
/**
|
|
1258
|
-
*
|
|
971
|
+
* Output with readonly type.
|
|
1259
972
|
*/
|
|
1260
|
-
type
|
|
973
|
+
type OutputWithReadonly<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends OutputWithQuestionMarks<TEntries, InferEntriesOutput<TEntries>>> = Readonly<TObject> & Pick<TObject, Exclude<keyof TObject, ReadonlyOutputKeys<TEntries>>>;
|
|
1261
974
|
/**
|
|
1262
975
|
* Infer object input type.
|
|
1263
976
|
*/
|
|
1264
|
-
type InferObjectInput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<
|
|
977
|
+
type InferObjectInput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<InputWithQuestionMarks<TEntries, InferEntriesInput<TEntries>>>;
|
|
1265
978
|
/**
|
|
1266
979
|
* Infer object output type.
|
|
1267
980
|
*/
|
|
1268
|
-
type InferObjectOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<
|
|
981
|
+
type InferObjectOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<OutputWithReadonly<TEntries, OutputWithQuestionMarks<TEntries, InferEntriesOutput<TEntries>>>>;
|
|
1269
982
|
/**
|
|
1270
983
|
* Infer object issue type.
|
|
1271
984
|
*/
|
package/dist/index.js
CHANGED
|
@@ -440,7 +440,7 @@ function optional(wrapped, ...args) {
|
|
|
440
440
|
kind: "schema",
|
|
441
441
|
type: "optional",
|
|
442
442
|
reference: optional,
|
|
443
|
-
expects:
|
|
443
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
444
444
|
async: false,
|
|
445
445
|
wrapped,
|
|
446
446
|
_run(dataset, config2) {
|
package/dist/index.mjs
CHANGED
|
@@ -434,7 +434,7 @@ function optional(wrapped, ...args) {
|
|
|
434
434
|
kind: "schema",
|
|
435
435
|
type: "optional",
|
|
436
436
|
reference: optional,
|
|
437
|
-
expects:
|
|
437
|
+
expects: `(${wrapped.expects} | undefined)`,
|
|
438
438
|
async: false,
|
|
439
439
|
wrapped,
|
|
440
440
|
_run(dataset, config2) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/shared",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1-beta.1",
|
|
4
4
|
"description": "ESLint React's Shared constants and functions.",
|
|
5
5
|
"homepage": "https://github.com/rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@typescript-eslint/utils": "^8.2.0",
|
|
39
39
|
"picomatch": "^4.0.2",
|
|
40
|
-
"@eslint-react/tools": "1.11.
|
|
40
|
+
"@eslint-react/tools": "1.11.1-beta.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/picomatch": "^3.0.1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"micro-memoize": "^4.1.2",
|
|
46
46
|
"tsup": "^8.2.4",
|
|
47
47
|
"type-fest": "^4.25.0",
|
|
48
|
-
"valibot": "^0.
|
|
48
|
+
"valibot": "^0.38.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsup --dts-resolve",
|