bupkis 0.18.1 → 0.18.2
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/CHANGELOG.md +7 -0
- package/package.json +1 -4
- package/src/assertion/assertion-types.ts +4 -4
- package/src/assertion/impl/sync-parametric.ts +1 -1
- package/src/expect.ts +0 -4
- package/src/guards.ts +24 -24
- package/src/internal-schema.ts +16 -32
- package/src/value-to-schema.ts +1 -1
- package/dist/assertion/assertion-async.cjs +0 -268
- package/dist/assertion/assertion-async.cjs.map +0 -1
- package/dist/assertion/assertion-async.d.cts +0 -40
- package/dist/assertion/assertion-async.d.cts.map +0 -1
- package/dist/assertion/assertion-async.d.ts +0 -40
- package/dist/assertion/assertion-async.d.ts.map +0 -1
- package/dist/assertion/assertion-async.js +0 -259
- package/dist/assertion/assertion-async.js.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.cjs +0 -132
- package/dist/assertion/assertion-standard-schema-async.cjs.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.d.cts +0 -52
- package/dist/assertion/assertion-standard-schema-async.d.cts.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.d.ts +0 -52
- package/dist/assertion/assertion-standard-schema-async.d.ts.map +0 -1
- package/dist/assertion/assertion-standard-schema-async.js +0 -128
- package/dist/assertion/assertion-standard-schema-async.js.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.cjs +0 -141
- package/dist/assertion/assertion-standard-schema-sync.cjs.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.d.cts +0 -52
- package/dist/assertion/assertion-standard-schema-sync.d.cts.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.d.ts +0 -52
- package/dist/assertion/assertion-standard-schema-sync.d.ts.map +0 -1
- package/dist/assertion/assertion-standard-schema-sync.js +0 -137
- package/dist/assertion/assertion-standard-schema-sync.js.map +0 -1
- package/dist/assertion/assertion-sync.cjs +0 -284
- package/dist/assertion/assertion-sync.cjs.map +0 -1
- package/dist/assertion/assertion-sync.d.cts +0 -60
- package/dist/assertion/assertion-sync.d.cts.map +0 -1
- package/dist/assertion/assertion-sync.d.ts +0 -60
- package/dist/assertion/assertion-sync.d.ts.map +0 -1
- package/dist/assertion/assertion-sync.js +0 -275
- package/dist/assertion/assertion-sync.js.map +0 -1
- package/dist/assertion/assertion-types.cjs +0 -20
- package/dist/assertion/assertion-types.cjs.map +0 -1
- package/dist/assertion/assertion-types.d.cts +0 -1086
- package/dist/assertion/assertion-types.d.cts.map +0 -1
- package/dist/assertion/assertion-types.d.ts +0 -1086
- package/dist/assertion/assertion-types.d.ts.map +0 -1
- package/dist/assertion/assertion-types.js +0 -19
- package/dist/assertion/assertion-types.js.map +0 -1
- package/dist/assertion/assertion.cjs +0 -382
- package/dist/assertion/assertion.cjs.map +0 -1
- package/dist/assertion/assertion.d.cts +0 -109
- package/dist/assertion/assertion.d.cts.map +0 -1
- package/dist/assertion/assertion.d.ts +0 -109
- package/dist/assertion/assertion.d.ts.map +0 -1
- package/dist/assertion/assertion.js +0 -375
- package/dist/assertion/assertion.js.map +0 -1
- package/dist/assertion/create.cjs +0 -148
- package/dist/assertion/create.cjs.map +0 -1
- package/dist/assertion/create.d.cts +0 -85
- package/dist/assertion/create.d.cts.map +0 -1
- package/dist/assertion/create.d.ts +0 -85
- package/dist/assertion/create.d.ts.map +0 -1
- package/dist/assertion/create.js +0 -143
- package/dist/assertion/create.js.map +0 -1
- package/dist/assertion/format-assertion-failure.cjs +0 -63
- package/dist/assertion/format-assertion-failure.cjs.map +0 -1
- package/dist/assertion/format-assertion-failure.d.cts +0 -21
- package/dist/assertion/format-assertion-failure.d.cts.map +0 -1
- package/dist/assertion/format-assertion-failure.d.ts +0 -21
- package/dist/assertion/format-assertion-failure.d.ts.map +0 -1
- package/dist/assertion/format-assertion-failure.js +0 -59
- package/dist/assertion/format-assertion-failure.js.map +0 -1
- package/dist/assertion/impl/assertion-util.cjs +0 -68
- package/dist/assertion/impl/assertion-util.cjs.map +0 -1
- package/dist/assertion/impl/assertion-util.d.cts +0 -36
- package/dist/assertion/impl/assertion-util.d.cts.map +0 -1
- package/dist/assertion/impl/assertion-util.d.ts +0 -36
- package/dist/assertion/impl/assertion-util.d.ts.map +0 -1
- package/dist/assertion/impl/assertion-util.js +0 -62
- package/dist/assertion/impl/assertion-util.js.map +0 -1
- package/dist/assertion/impl/async-iterable.cjs +0 -627
- package/dist/assertion/impl/async-iterable.cjs.map +0 -1
- package/dist/assertion/impl/async-iterable.d.cts +0 -406
- package/dist/assertion/impl/async-iterable.d.cts.map +0 -1
- package/dist/assertion/impl/async-iterable.d.ts +0 -406
- package/dist/assertion/impl/async-iterable.d.ts.map +0 -1
- package/dist/assertion/impl/async-iterable.js +0 -624
- package/dist/assertion/impl/async-iterable.js.map +0 -1
- package/dist/assertion/impl/async-parametric.cjs +0 -412
- package/dist/assertion/impl/async-parametric.cjs.map +0 -1
- package/dist/assertion/impl/async-parametric.d.cts +0 -278
- package/dist/assertion/impl/async-parametric.d.cts.map +0 -1
- package/dist/assertion/impl/async-parametric.d.ts +0 -278
- package/dist/assertion/impl/async-parametric.d.ts.map +0 -1
- package/dist/assertion/impl/async-parametric.js +0 -409
- package/dist/assertion/impl/async-parametric.js.map +0 -1
- package/dist/assertion/impl/async.cjs +0 -56
- package/dist/assertion/impl/async.cjs.map +0 -1
- package/dist/assertion/impl/async.d.cts +0 -179
- package/dist/assertion/impl/async.d.cts.map +0 -1
- package/dist/assertion/impl/async.d.ts +0 -179
- package/dist/assertion/impl/async.d.ts.map +0 -1
- package/dist/assertion/impl/async.js +0 -39
- package/dist/assertion/impl/async.js.map +0 -1
- package/dist/assertion/impl/index.cjs +0 -37
- package/dist/assertion/impl/index.cjs.map +0 -1
- package/dist/assertion/impl/index.d.cts +0 -21
- package/dist/assertion/impl/index.d.cts.map +0 -1
- package/dist/assertion/impl/index.d.ts +0 -21
- package/dist/assertion/impl/index.d.ts.map +0 -1
- package/dist/assertion/impl/index.js +0 -21
- package/dist/assertion/impl/index.js.map +0 -1
- package/dist/assertion/impl/iteration-util.cjs +0 -297
- package/dist/assertion/impl/iteration-util.cjs.map +0 -1
- package/dist/assertion/impl/iteration-util.d.cts +0 -12
- package/dist/assertion/impl/iteration-util.d.cts.map +0 -1
- package/dist/assertion/impl/iteration-util.d.ts +0 -12
- package/dist/assertion/impl/iteration-util.d.ts.map +0 -1
- package/dist/assertion/impl/iteration-util.js +0 -282
- package/dist/assertion/impl/iteration-util.js.map +0 -1
- package/dist/assertion/impl/snapshot.cjs +0 -276
- package/dist/assertion/impl/snapshot.cjs.map +0 -1
- package/dist/assertion/impl/snapshot.d.cts +0 -278
- package/dist/assertion/impl/snapshot.d.cts.map +0 -1
- package/dist/assertion/impl/snapshot.d.ts +0 -278
- package/dist/assertion/impl/snapshot.d.ts.map +0 -1
- package/dist/assertion/impl/snapshot.js +0 -273
- package/dist/assertion/impl/snapshot.js.map +0 -1
- package/dist/assertion/impl/sync-basic.cjs +0 -553
- package/dist/assertion/impl/sync-basic.cjs.map +0 -1
- package/dist/assertion/impl/sync-basic.d.cts +0 -528
- package/dist/assertion/impl/sync-basic.d.cts.map +0 -1
- package/dist/assertion/impl/sync-basic.d.ts +0 -528
- package/dist/assertion/impl/sync-basic.d.ts.map +0 -1
- package/dist/assertion/impl/sync-basic.js +0 -550
- package/dist/assertion/impl/sync-basic.js.map +0 -1
- package/dist/assertion/impl/sync-collection.cjs +0 -856
- package/dist/assertion/impl/sync-collection.cjs.map +0 -1
- package/dist/assertion/impl/sync-collection.d.cts +0 -607
- package/dist/assertion/impl/sync-collection.d.cts.map +0 -1
- package/dist/assertion/impl/sync-collection.d.ts +0 -607
- package/dist/assertion/impl/sync-collection.d.ts.map +0 -1
- package/dist/assertion/impl/sync-collection.js +0 -850
- package/dist/assertion/impl/sync-collection.js.map +0 -1
- package/dist/assertion/impl/sync-date.cjs +0 -341
- package/dist/assertion/impl/sync-date.cjs.map +0 -1
- package/dist/assertion/impl/sync-date.d.cts +0 -209
- package/dist/assertion/impl/sync-date.d.cts.map +0 -1
- package/dist/assertion/impl/sync-date.d.ts +0 -209
- package/dist/assertion/impl/sync-date.d.ts.map +0 -1
- package/dist/assertion/impl/sync-date.js +0 -338
- package/dist/assertion/impl/sync-date.js.map +0 -1
- package/dist/assertion/impl/sync-esoteric.cjs +0 -214
- package/dist/assertion/impl/sync-esoteric.cjs.map +0 -1
- package/dist/assertion/impl/sync-esoteric.d.cts +0 -191
- package/dist/assertion/impl/sync-esoteric.d.cts.map +0 -1
- package/dist/assertion/impl/sync-esoteric.d.ts +0 -191
- package/dist/assertion/impl/sync-esoteric.d.ts.map +0 -1
- package/dist/assertion/impl/sync-esoteric.js +0 -211
- package/dist/assertion/impl/sync-esoteric.js.map +0 -1
- package/dist/assertion/impl/sync-iterable.cjs +0 -512
- package/dist/assertion/impl/sync-iterable.cjs.map +0 -1
- package/dist/assertion/impl/sync-iterable.d.cts +0 -334
- package/dist/assertion/impl/sync-iterable.d.cts.map +0 -1
- package/dist/assertion/impl/sync-iterable.d.ts +0 -334
- package/dist/assertion/impl/sync-iterable.d.ts.map +0 -1
- package/dist/assertion/impl/sync-iterable.js +0 -509
- package/dist/assertion/impl/sync-iterable.js.map +0 -1
- package/dist/assertion/impl/sync-parametric.cjs +0 -805
- package/dist/assertion/impl/sync-parametric.cjs.map +0 -1
- package/dist/assertion/impl/sync-parametric.d.cts +0 -560
- package/dist/assertion/impl/sync-parametric.d.cts.map +0 -1
- package/dist/assertion/impl/sync-parametric.d.ts +0 -560
- package/dist/assertion/impl/sync-parametric.d.ts.map +0 -1
- package/dist/assertion/impl/sync-parametric.js +0 -802
- package/dist/assertion/impl/sync-parametric.js.map +0 -1
- package/dist/assertion/impl/sync.cjs +0 -214
- package/dist/assertion/impl/sync.cjs.map +0 -1
- package/dist/assertion/impl/sync.d.cts +0 -512
- package/dist/assertion/impl/sync.d.cts.map +0 -1
- package/dist/assertion/impl/sync.d.ts +0 -512
- package/dist/assertion/impl/sync.d.ts.map +0 -1
- package/dist/assertion/impl/sync.js +0 -197
- package/dist/assertion/impl/sync.js.map +0 -1
- package/dist/assertion/index.cjs +0 -38
- package/dist/assertion/index.cjs.map +0 -1
- package/dist/assertion/index.d.cts +0 -18
- package/dist/assertion/index.d.cts.map +0 -1
- package/dist/assertion/index.d.ts +0 -18
- package/dist/assertion/index.d.ts.map +0 -1
- package/dist/assertion/index.js +0 -17
- package/dist/assertion/index.js.map +0 -1
- package/dist/assertion/slotify.cjs +0 -165
- package/dist/assertion/slotify.cjs.map +0 -1
- package/dist/assertion/slotify.d.cts +0 -11
- package/dist/assertion/slotify.d.cts.map +0 -1
- package/dist/assertion/slotify.d.ts +0 -11
- package/dist/assertion/slotify.d.ts.map +0 -1
- package/dist/assertion/slotify.js +0 -161
- package/dist/assertion/slotify.js.map +0 -1
- package/dist/bootstrap.cjs +0 -43
- package/dist/bootstrap.cjs.map +0 -1
- package/dist/bootstrap.d.cts +0 -27
- package/dist/bootstrap.d.cts.map +0 -1
- package/dist/bootstrap.d.ts +0 -27
- package/dist/bootstrap.d.ts.map +0 -1
- package/dist/bootstrap.js +0 -40
- package/dist/bootstrap.js.map +0 -1
- package/dist/constant.cjs +0 -82
- package/dist/constant.cjs.map +0 -1
- package/dist/constant.d.cts +0 -69
- package/dist/constant.d.cts.map +0 -1
- package/dist/constant.d.ts +0 -69
- package/dist/constant.d.ts.map +0 -1
- package/dist/constant.js +0 -79
- package/dist/constant.js.map +0 -1
- package/dist/diff.cjs +0 -340
- package/dist/diff.cjs.map +0 -1
- package/dist/diff.d.cts +0 -51
- package/dist/diff.d.cts.map +0 -1
- package/dist/diff.d.ts +0 -51
- package/dist/diff.d.ts.map +0 -1
- package/dist/diff.js +0 -334
- package/dist/diff.js.map +0 -1
- package/dist/error.cjs +0 -204
- package/dist/error.cjs.map +0 -1
- package/dist/error.d.cts +0 -212
- package/dist/error.d.cts.map +0 -1
- package/dist/error.d.ts +0 -212
- package/dist/error.d.ts.map +0 -1
- package/dist/error.js +0 -191
- package/dist/error.js.map +0 -1
- package/dist/expect.cjs +0 -590
- package/dist/expect.cjs.map +0 -1
- package/dist/expect.d.cts +0 -138
- package/dist/expect.d.cts.map +0 -1
- package/dist/expect.d.ts +0 -138
- package/dist/expect.d.ts.map +0 -1
- package/dist/expect.js +0 -582
- package/dist/expect.js.map +0 -1
- package/dist/guards.cjs +0 -297
- package/dist/guards.cjs.map +0 -1
- package/dist/guards.d.cts +0 -231
- package/dist/guards.d.cts.map +0 -1
- package/dist/guards.d.ts +0 -231
- package/dist/guards.d.ts.map +0 -1
- package/dist/guards.js +0 -277
- package/dist/guards.js.map +0 -1
- package/dist/index.cjs +0 -111
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -448
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts +0 -448
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -71
- package/dist/index.js.map +0 -1
- package/dist/internal-schema.cjs +0 -253
- package/dist/internal-schema.cjs.map +0 -1
- package/dist/internal-schema.d.cts +0 -8
- package/dist/internal-schema.d.cts.map +0 -1
- package/dist/internal-schema.d.ts +0 -8
- package/dist/internal-schema.d.ts.map +0 -1
- package/dist/internal-schema.js +0 -248
- package/dist/internal-schema.js.map +0 -1
- package/dist/metadata.cjs +0 -57
- package/dist/metadata.cjs.map +0 -1
- package/dist/metadata.d.cts +0 -27
- package/dist/metadata.d.cts.map +0 -1
- package/dist/metadata.d.ts +0 -27
- package/dist/metadata.d.ts.map +0 -1
- package/dist/metadata.js +0 -54
- package/dist/metadata.js.map +0 -1
- package/dist/schema.cjs +0 -1522
- package/dist/schema.cjs.map +0 -1
- package/dist/schema.d.cts +0 -1196
- package/dist/schema.d.cts.map +0 -1
- package/dist/schema.d.ts +0 -1196
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -1516
- package/dist/schema.js.map +0 -1
- package/dist/snapshot/adapter.cjs +0 -31
- package/dist/snapshot/adapter.cjs.map +0 -1
- package/dist/snapshot/adapter.d.cts +0 -258
- package/dist/snapshot/adapter.d.cts.map +0 -1
- package/dist/snapshot/adapter.d.ts +0 -258
- package/dist/snapshot/adapter.d.ts.map +0 -1
- package/dist/snapshot/adapter.js +0 -27
- package/dist/snapshot/adapter.js.map +0 -1
- package/dist/snapshot/adapters/fallback.cjs +0 -453
- package/dist/snapshot/adapters/fallback.cjs.map +0 -1
- package/dist/snapshot/adapters/fallback.d.cts +0 -185
- package/dist/snapshot/adapters/fallback.d.cts.map +0 -1
- package/dist/snapshot/adapters/fallback.d.ts +0 -185
- package/dist/snapshot/adapters/fallback.d.ts.map +0 -1
- package/dist/snapshot/adapters/fallback.js +0 -446
- package/dist/snapshot/adapters/fallback.js.map +0 -1
- package/dist/snapshot/adapters/node-test.cjs +0 -301
- package/dist/snapshot/adapters/node-test.cjs.map +0 -1
- package/dist/snapshot/adapters/node-test.d.cts +0 -131
- package/dist/snapshot/adapters/node-test.d.cts.map +0 -1
- package/dist/snapshot/adapters/node-test.d.ts +0 -131
- package/dist/snapshot/adapters/node-test.d.ts.map +0 -1
- package/dist/snapshot/adapters/node-test.js +0 -297
- package/dist/snapshot/adapters/node-test.js.map +0 -1
- package/dist/snapshot/index.cjs +0 -61
- package/dist/snapshot/index.cjs.map +0 -1
- package/dist/snapshot/index.d.cts +0 -40
- package/dist/snapshot/index.d.cts.map +0 -1
- package/dist/snapshot/index.d.ts +0 -40
- package/dist/snapshot/index.d.ts.map +0 -1
- package/dist/snapshot/index.js +0 -44
- package/dist/snapshot/index.js.map +0 -1
- package/dist/snapshot/node-version.cjs +0 -49
- package/dist/snapshot/node-version.cjs.map +0 -1
- package/dist/snapshot/node-version.d.cts +0 -34
- package/dist/snapshot/node-version.d.cts.map +0 -1
- package/dist/snapshot/node-version.d.ts +0 -34
- package/dist/snapshot/node-version.d.ts.map +0 -1
- package/dist/snapshot/node-version.js +0 -44
- package/dist/snapshot/node-version.js.map +0 -1
- package/dist/snapshot/select-adapter.cjs +0 -170
- package/dist/snapshot/select-adapter.cjs.map +0 -1
- package/dist/snapshot/select-adapter.d.cts +0 -128
- package/dist/snapshot/select-adapter.d.cts.map +0 -1
- package/dist/snapshot/select-adapter.d.ts +0 -128
- package/dist/snapshot/select-adapter.d.ts.map +0 -1
- package/dist/snapshot/select-adapter.js +0 -164
- package/dist/snapshot/select-adapter.js.map +0 -1
- package/dist/snapshot/serializer.cjs +0 -246
- package/dist/snapshot/serializer.cjs.map +0 -1
- package/dist/snapshot/serializer.d.cts +0 -126
- package/dist/snapshot/serializer.d.cts.map +0 -1
- package/dist/snapshot/serializer.d.ts +0 -126
- package/dist/snapshot/serializer.d.ts.map +0 -1
- package/dist/snapshot/serializer.js +0 -238
- package/dist/snapshot/serializer.js.map +0 -1
- package/dist/standard-schema.cjs +0 -13
- package/dist/standard-schema.cjs.map +0 -1
- package/dist/standard-schema.d.cts +0 -192
- package/dist/standard-schema.d.cts.map +0 -1
- package/dist/standard-schema.d.ts +0 -192
- package/dist/standard-schema.d.ts.map +0 -1
- package/dist/standard-schema.js +0 -12
- package/dist/standard-schema.js.map +0 -1
- package/dist/types.cjs +0 -22
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts +0 -905
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.ts +0 -905
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -21
- package/dist/types.js.map +0 -1
- package/dist/use.cjs +0 -240
- package/dist/use.cjs.map +0 -1
- package/dist/use.d.cts +0 -8
- package/dist/use.d.cts.map +0 -1
- package/dist/use.d.ts +0 -8
- package/dist/use.d.ts.map +0 -1
- package/dist/use.js +0 -236
- package/dist/use.js.map +0 -1
- package/dist/util.cjs +0 -255
- package/dist/util.cjs.map +0 -1
- package/dist/util.d.cts +0 -141
- package/dist/util.d.cts.map +0 -1
- package/dist/util.d.ts +0 -141
- package/dist/util.d.ts.map +0 -1
- package/dist/util.js +0 -234
- package/dist/util.js.map +0 -1
- package/dist/value-to-schema.cjs +0 -537
- package/dist/value-to-schema.cjs.map +0 -1
- package/dist/value-to-schema.d.cts +0 -144
- package/dist/value-to-schema.d.cts.map +0 -1
- package/dist/value-to-schema.d.ts +0 -144
- package/dist/value-to-schema.d.ts.map +0 -1
- package/dist/value-to-schema.js +0 -533
- package/dist/value-to-schema.js.map +0 -1
package/dist/types.d.cts
DELETED
|
@@ -1,905 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Types used throughout <span class="bupkis">BUPKIS</span>.
|
|
3
|
-
*
|
|
4
|
-
* May be useful for those building on top of <span
|
|
5
|
-
* class="bupkis">BUPKIS</span>.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* // namespace
|
|
11
|
-
* import { types } from 'bupkis';
|
|
12
|
-
* // subpath import
|
|
13
|
-
* import type * as alsoTypes from 'bupkis/types';
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @groupDescription Utility Types
|
|
17
|
-
* Types used throughout <span class="bupkis">BUPKIS</span>.
|
|
18
|
-
* @packageDocumentation
|
|
19
|
-
*/
|
|
20
|
-
import type { ArrayValues, TupleToUnion, Constructor as TypeFestConstructor, UnionToIntersection } from 'type-fest';
|
|
21
|
-
import type { z } from 'zod';
|
|
22
|
-
import type { AnyAssertion, AnyAsyncAssertion, AnyAsyncAssertions, AnySyncAssertion, AnySyncAssertions, AssertionPart, AssertionParts, AssertionSlot, BuiltinAsyncAssertions, BuiltinSyncAssertions, CreateAssertionFn, CreateAsyncAssertionFn, NoNeverTuple, PhraseLiteral, PhraseLiteralChoice, PhraseLiteralChoiceSlot, PhraseLiteralSlot } from "./assertion/assertion-types.cjs";
|
|
23
|
-
import type { StandardSchemaV1 } from "./standard-schema.cjs";
|
|
24
|
-
import type { ValueToSchemaOptions } from "./value-to-schema.cjs";
|
|
25
|
-
/**
|
|
26
|
-
* Creates a negated version of a tuple of
|
|
27
|
-
* {@link AssertionPart | AssertionParts}.
|
|
28
|
-
*
|
|
29
|
-
* For {@link PhraseLiteral | PhraseLiterals}, creates a
|
|
30
|
-
* {@link Negation | "not" variant}. For
|
|
31
|
-
* {@link PhraseLiteralChoice | PhraseLiteralChoices}, creates negated versions
|
|
32
|
-
* of each `Phrase` in the array.
|
|
33
|
-
*
|
|
34
|
-
* Does not affect Zod schemas.
|
|
35
|
-
*
|
|
36
|
-
* @template Parts Parts containing `PhraseLiterals` or `PhraseLiteralChoices`
|
|
37
|
-
* to negate.
|
|
38
|
-
*/
|
|
39
|
-
export type AddNegation<Parts extends readonly AssertionPart[]> = Parts extends readonly [
|
|
40
|
-
infer First extends AssertionPart,
|
|
41
|
-
...infer Rest extends readonly AssertionPart[]
|
|
42
|
-
] ? First extends PhraseLiteralChoice ? readonly [
|
|
43
|
-
{
|
|
44
|
-
[K in keyof First]: First[K] extends PhraseLiteral ? Negation<First[K]> : never;
|
|
45
|
-
},
|
|
46
|
-
...AddNegation<Rest>
|
|
47
|
-
] : First extends PhraseLiteral ? readonly [Negation<First>, ...AddNegation<Rest>] : readonly [First, ...AddNegation<Rest>] : readonly [];
|
|
48
|
-
/**
|
|
49
|
-
* Base set of properties included in both {@link Expect} and {@link ExpectAsync}.
|
|
50
|
-
*
|
|
51
|
-
* @preventExpand
|
|
52
|
-
* @group Expect-Related
|
|
53
|
-
*/
|
|
54
|
-
export interface BaseExpect {
|
|
55
|
-
/**
|
|
56
|
-
* Creates a new synchronous assertion.
|
|
57
|
-
*/
|
|
58
|
-
createAssertion: CreateAssertionFn;
|
|
59
|
-
/**
|
|
60
|
-
* Creates a new asynchronous assertion.
|
|
61
|
-
*/
|
|
62
|
-
createAsyncAssertion: CreateAsyncAssertionFn;
|
|
63
|
-
/**
|
|
64
|
-
* Fails immediately with optional `reason`.
|
|
65
|
-
*
|
|
66
|
-
* @param reason Reason for failure
|
|
67
|
-
* @throws {AssertionError}
|
|
68
|
-
*/
|
|
69
|
-
fail: FailFn;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Configuration for valueToSchema benchmark generation.
|
|
73
|
-
*/
|
|
74
|
-
export interface BenchmarkConfig {
|
|
75
|
-
/** Optional filter for input categories */
|
|
76
|
-
categories?: string[];
|
|
77
|
-
/** Complexity levels to test */
|
|
78
|
-
complexityLevels: ComplexityLevel[];
|
|
79
|
-
/** Number of benchmark iterations (1-10000) */
|
|
80
|
-
iterations: number;
|
|
81
|
-
/** ValueToSchemaOptions combinations to test */
|
|
82
|
-
options?: Partial<ValueToSchemaOptions>[];
|
|
83
|
-
/** Number of test data samples to generate (10-10000) */
|
|
84
|
-
sampleSize: number;
|
|
85
|
-
/** Benchmark timeout in milliseconds (1000-300000) */
|
|
86
|
-
timeout: number;
|
|
87
|
-
/** Number of warmup iterations (1-100) */
|
|
88
|
-
warmupIterations: number;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Type representing a dot-notation or bracket-notation keypath for accessing
|
|
92
|
-
* nested object properties. Uses recursive template literal types to validate
|
|
93
|
-
* keypath syntax.
|
|
94
|
-
*
|
|
95
|
-
* Supports paths like:
|
|
96
|
-
*
|
|
97
|
-
* - 'foo.bar'
|
|
98
|
-
* - 'foo[0]'
|
|
99
|
-
* - 'foo["bar-baz"]'
|
|
100
|
-
* - 'foo.bar[1].baz'
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
/**
|
|
105
|
-
* Complete benchmark result.
|
|
106
|
-
*/
|
|
107
|
-
export interface BenchmarkResult {
|
|
108
|
-
/** Computed insights and bottleneck identification */
|
|
109
|
-
analysis: PerformanceAnalysis;
|
|
110
|
-
/** Environment details when benchmark was run */
|
|
111
|
-
executionContext: ExecutionContext;
|
|
112
|
-
/** Total execution time in milliseconds */
|
|
113
|
-
executionTime: number;
|
|
114
|
-
/** Metadata about the benchmark run */
|
|
115
|
-
metadata: {
|
|
116
|
-
nodeVersion: string;
|
|
117
|
-
timestamp: string;
|
|
118
|
-
version: string;
|
|
119
|
-
};
|
|
120
|
-
/** Individual measurement results */
|
|
121
|
-
results: PerformanceMetrics[];
|
|
122
|
-
/** Benchmark suite identifier */
|
|
123
|
-
suiteId: string;
|
|
124
|
-
}
|
|
125
|
-
export type * from "./assertion/assertion-types.cjs";
|
|
126
|
-
export type { StandardSchemaV1 };
|
|
127
|
-
/**
|
|
128
|
-
* The main API as returned by a {@link UseFn}.
|
|
129
|
-
*
|
|
130
|
-
* @template BaseSyncAssertions Base set of synchronous
|
|
131
|
-
* {@link Assertion | Assertions}; will be the builtin sync assertions, at
|
|
132
|
-
* minimum)
|
|
133
|
-
* @template BaseAsyncAssertions Base set of asynchronous
|
|
134
|
-
* {@link Assertion | Assertions}; will be the builtin async assertions, at
|
|
135
|
-
* minimum)
|
|
136
|
-
* @template ExtendedSyncAssertions Synchronous assertions extracted from
|
|
137
|
-
* `MixedAssertions`
|
|
138
|
-
* @template ExtendedAsyncAssertions Asynchronous assertions extracted from
|
|
139
|
-
* `MixedAssertions`
|
|
140
|
-
* @group Core API
|
|
141
|
-
*/
|
|
142
|
-
export interface Bupkis<BaseSyncAssertions extends AnySyncAssertions, BaseAsyncAssertions extends AnyAsyncAssertions, ExtendedSyncAssertions extends readonly AnySyncAssertion[] = readonly [], ExtendedAsyncAssertions extends readonly AnyAsyncAssertion[] = readonly []> {
|
|
143
|
-
/**
|
|
144
|
-
* A new {@link Expect} function which handles {@link ExtendedSyncAssertions}
|
|
145
|
-
* and {@link BaseSyncAssertions}
|
|
146
|
-
*/
|
|
147
|
-
expect: Expect<Concat<BaseSyncAssertions, ExtendedSyncAssertions>, Concat<BaseAsyncAssertions, ExtendedAsyncAssertions>>;
|
|
148
|
-
/**
|
|
149
|
-
* A new {@link ExpectAsync} function which handles
|
|
150
|
-
* {@link ExtendedAsyncAssertions} and {@link BaseAsyncAssertions}
|
|
151
|
-
*/
|
|
152
|
-
expectAsync: ExpectAsync<Concat<BaseAsyncAssertions, ExtendedAsyncAssertions>, Concat<BaseSyncAssertions, ExtendedSyncAssertions>>;
|
|
153
|
-
/**
|
|
154
|
-
* For composing arrays of assertions, one after another.
|
|
155
|
-
*
|
|
156
|
-
* The _only_ chainable API in <span class="bupkis">Bupkis</span>.
|
|
157
|
-
*
|
|
158
|
-
* @since 0.1.0
|
|
159
|
-
* @example
|
|
160
|
-
*
|
|
161
|
-
* ```ts
|
|
162
|
-
* const { expect } = use([...someAssertions]).use([...otherAssertions]);
|
|
163
|
-
* ```
|
|
164
|
-
*/
|
|
165
|
-
use: UseFn<Concat<BaseSyncAssertions, ExtendedSyncAssertions>, Concat<BaseAsyncAssertions, ExtendedAsyncAssertions>>;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Complexity levels for test data generation.
|
|
169
|
-
*/
|
|
170
|
-
export type ComplexityLevel = 'complex' | 'medium' | 'simple';
|
|
171
|
-
/**
|
|
172
|
-
* Helper type to concatenate two tuples
|
|
173
|
-
*
|
|
174
|
-
* @group Utility Types
|
|
175
|
-
*/
|
|
176
|
-
export type Concat<TupleA extends readonly unknown[], TupleB extends readonly unknown[]> = readonly [...TupleA, ...TupleB];
|
|
177
|
-
/**
|
|
178
|
-
* A constructor based on {@link TypeFestConstructor type-fest's Constructor}
|
|
179
|
-
* with a default instance type argument.
|
|
180
|
-
*
|
|
181
|
-
* @group Utility Types
|
|
182
|
-
*/
|
|
183
|
-
export type Constructor<Instance = any, Args extends unknown[] = any[]> = TypeFestConstructor<Instance, Args>;
|
|
184
|
-
export type DefFromZodType<T extends z.core.$ZodType | z.ZodType> = T extends z.ZodType ? T['def'] : T extends z.core.$ZodType ? T['_zod']['def'] : never;
|
|
185
|
-
/**
|
|
186
|
-
* Execution context for benchmark runs.
|
|
187
|
-
*/
|
|
188
|
-
export interface ExecutionContext {
|
|
189
|
-
/** CPU model */
|
|
190
|
-
cpuModel: string;
|
|
191
|
-
/** Total memory */
|
|
192
|
-
memoryTotal: number;
|
|
193
|
-
/** Node.js version */
|
|
194
|
-
nodeVersion: string;
|
|
195
|
-
/** Platform information */
|
|
196
|
-
platform: string;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Execution time statistics.
|
|
200
|
-
*/
|
|
201
|
-
export interface ExecutionTimeStats {
|
|
202
|
-
/** Mean execution time */
|
|
203
|
-
mean: number;
|
|
204
|
-
/** Median execution time */
|
|
205
|
-
median: number;
|
|
206
|
-
/** 95th percentile execution time */
|
|
207
|
-
p95: number;
|
|
208
|
-
/** 99th percentile execution time */
|
|
209
|
-
p99: number;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* The main synchronous assertion function.
|
|
213
|
-
*
|
|
214
|
-
* Contains properties in {@link ExpectSyncProps}.
|
|
215
|
-
*
|
|
216
|
-
* @template SyncAssertions All synchronous assertions available
|
|
217
|
-
* @template AsyncAssertions All asynchronous assertions available; for use in
|
|
218
|
-
* {@link ExpectSyncProps.use} only.
|
|
219
|
-
* @expandType ExpectSyncProps
|
|
220
|
-
* @group Core API
|
|
221
|
-
* @see {@link expect}
|
|
222
|
-
*/
|
|
223
|
-
export type Expect<SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions, AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions> = ExpectFunction<SyncAssertions> & ExpectSyncProps<SyncAssertions, AsyncAssertions>;
|
|
224
|
-
/**
|
|
225
|
-
* The main asynchronous assertion function.
|
|
226
|
-
*
|
|
227
|
-
* Contains properties in {@link ExpectAsyncProps}.
|
|
228
|
-
*
|
|
229
|
-
* @template AsyncAssertions All asynchronous assertions available
|
|
230
|
-
* @template SyncAssertions All synchronous assertions available; for use in
|
|
231
|
-
* {@link ExpectAsyncProps.use} only.
|
|
232
|
-
* @expandType ExpectAsyncProps
|
|
233
|
-
* @group Core API
|
|
234
|
-
* @see {@link expectAsync}
|
|
235
|
-
*/
|
|
236
|
-
export type ExpectAsync<AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions, SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions> = ExpectAsyncFunction<AsyncAssertions> & ExpectAsyncProps<AsyncAssertions, SyncAssertions>;
|
|
237
|
-
/**
|
|
238
|
-
* The callable function type for asynchronous assertions.
|
|
239
|
-
*
|
|
240
|
-
* This type represents the actual function signature of an async expect
|
|
241
|
-
* function, created by mapping all available assertions to their respective
|
|
242
|
-
* function signatures and combining them using intersection types. Each
|
|
243
|
-
* assertion contributes its own overload to the final function type.
|
|
244
|
-
*
|
|
245
|
-
* The function signatures are derived from the {@link AssertionParts} of each
|
|
246
|
-
* assertion, with parameters that match the expected slots for natural language
|
|
247
|
-
* assertion calls.
|
|
248
|
-
*
|
|
249
|
-
* @example
|
|
250
|
-
*
|
|
251
|
-
* ```typescript
|
|
252
|
-
* // Example function type derived from async assertions
|
|
253
|
-
* const expectAsync: ExpectAsyncFunction<MyAsyncAssertions> = ...;
|
|
254
|
-
* await expectAsync(promise, 'to resolve');
|
|
255
|
-
* await expectAsync(promise, 'to resolve with value satisfying', expectedValue);
|
|
256
|
-
* ```
|
|
257
|
-
*
|
|
258
|
-
* @template AsyncAssertions - Array of async assertion objects that define
|
|
259
|
-
* available assertion logic
|
|
260
|
-
* @see {@link ExpectFunction} for the synchronous equivalent
|
|
261
|
-
* @see {@link SlotsFromParts} for how assertion parts are converted to function parameters
|
|
262
|
-
*/
|
|
263
|
-
export type ExpectAsyncFunction<AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions> = UnionToIntersection<TupleToUnion<{
|
|
264
|
-
[K in keyof AsyncAssertions]: (...args: MutableOrReadonly<SlotsFromParts<AsyncAssertions[K]['parts']>>) => Promise<void>;
|
|
265
|
-
}>>;
|
|
266
|
-
/**
|
|
267
|
-
* Properties available on asynchronous expect functions.
|
|
268
|
-
*
|
|
269
|
-
* This interface defines the additional properties and methods that are
|
|
270
|
-
* attached to async expect functions, extending the base expect functionality
|
|
271
|
-
* with async-specific features. These properties provide access to the
|
|
272
|
-
* underlying assertions and enable function composition through the
|
|
273
|
-
* {@link UseFn | `use`} method.
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
*
|
|
277
|
-
* ```typescript
|
|
278
|
-
* const expectAsync: ExpectAsync<MyAsyncAssertions> =
|
|
279
|
-
* createExpectAsyncFunction(assertions);
|
|
280
|
-
*
|
|
281
|
-
* // Access the underlying assertions
|
|
282
|
-
* console.log(expectAsync.assertions.length);
|
|
283
|
-
*
|
|
284
|
-
* // Compose with additional assertions
|
|
285
|
-
* const { expectAsync: enhanced } = expectAsync.use(moreAssertions);
|
|
286
|
-
* ```
|
|
287
|
-
*
|
|
288
|
-
* @template AsyncAssertions - Array of async assertion objects available to
|
|
289
|
-
* this expect function
|
|
290
|
-
* @template SyncAssertions - Array of sync assertion objects available for
|
|
291
|
-
* composition via {@link UseFn | `use`}
|
|
292
|
-
* @group Expect-Related
|
|
293
|
-
*/
|
|
294
|
-
export interface ExpectAsyncProps<AsyncAssertions extends AnyAsyncAssertions, SyncAssertions extends AnySyncAssertions> extends BaseExpect {
|
|
295
|
-
/**
|
|
296
|
-
* Tuple of all assertions available in this `expect()`.
|
|
297
|
-
*
|
|
298
|
-
* @preventExpand
|
|
299
|
-
*/
|
|
300
|
-
assertions: AsyncAssertions;
|
|
301
|
-
/**
|
|
302
|
-
* {@inheritDoc ExpectItAsync}
|
|
303
|
-
*/
|
|
304
|
-
it: ExpectItAsync<AsyncAssertions>;
|
|
305
|
-
/**
|
|
306
|
-
* {@inheritDoc UseFn}
|
|
307
|
-
*/
|
|
308
|
-
use: UseFn<SyncAssertions, AsyncAssertions>;
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* The function part of {@link Expect}.
|
|
312
|
-
*
|
|
313
|
-
* This is an intersection of all function signatures derived from the available
|
|
314
|
-
* synchronous assertions.
|
|
315
|
-
*/
|
|
316
|
-
export type ExpectFunction<SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions> = UnionToIntersection<TupleToUnion<{
|
|
317
|
-
[K in keyof SyncAssertions]: (...args: MutableOrReadonly<SlotsFromParts<SyncAssertions[K]['parts']>>) => void;
|
|
318
|
-
}>>;
|
|
319
|
-
/**
|
|
320
|
-
* Creates embeddable assertion functions that can be used with `'to satisfy'`.
|
|
321
|
-
*
|
|
322
|
-
* This type generates a union of all possible `expect.it` function signatures
|
|
323
|
-
* based on the available synchronous assertions. Each assertion contributes its
|
|
324
|
-
* own function signature to create embeddable executors that can be used within
|
|
325
|
-
* object patterns for complex validation scenarios.
|
|
326
|
-
*
|
|
327
|
-
* The resulting functions are designed to be used exclusively within `'to
|
|
328
|
-
* satisfy'` assertion contexts, where they provide type-safe pattern matching
|
|
329
|
-
* for nested object structures. Direct execution of these functions outside of
|
|
330
|
-
* their intended context is not supported.
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
*
|
|
334
|
-
* ```typescript
|
|
335
|
-
* // Create embeddable assertion functions
|
|
336
|
-
* const isString = expect.it('to be a string');
|
|
337
|
-
* const isPositive = expect.it('to be greater than', 0);
|
|
338
|
-
*
|
|
339
|
-
* // Use within 'to satisfy' patterns
|
|
340
|
-
* expect(user, 'to satisfy', {
|
|
341
|
-
* name: isString,
|
|
342
|
-
* age: isPositive,
|
|
343
|
-
* email: /\S+@\S+/,
|
|
344
|
-
* });
|
|
345
|
-
* ```
|
|
346
|
-
*
|
|
347
|
-
* @template SyncAssertions - Array of synchronous assertion objects that define
|
|
348
|
-
* the available assertion logic for embeddable functions
|
|
349
|
-
* @group Core API
|
|
350
|
-
* @see {@link ExpectItFunction} for individual function signature generation
|
|
351
|
-
* @see {@link ExpectItExecutor} for the executor function interface
|
|
352
|
-
*/
|
|
353
|
-
export type ExpectIt<SyncAssertions extends AnySyncAssertions = BuiltinSyncAssertions> = UnionToIntersection<TupleToUnion<{
|
|
354
|
-
[K in keyof SyncAssertions]: SyncAssertions[K] extends AnySyncAssertion ? SyncAssertions[K]['parts'] extends AssertionParts ? ExpectItFunction<SyncAssertions[K]['parts']> : never : never;
|
|
355
|
-
}>>;
|
|
356
|
-
/**
|
|
357
|
-
* Factory type for creating async embeddable assertion executors.
|
|
358
|
-
*
|
|
359
|
-
* This type generates a union of all possible `expectAsync.it` function
|
|
360
|
-
* signatures based on the available asynchronous assertions. Each assertion
|
|
361
|
-
* contributes its own function signature to create embeddable async executors
|
|
362
|
-
* that can be used within async object patterns for complex validation
|
|
363
|
-
* scenarios.
|
|
364
|
-
*
|
|
365
|
-
* The resulting functions are designed to be used exclusively within async `'to
|
|
366
|
-
* satisfy'` assertion contexts, where they provide type-safe pattern matching
|
|
367
|
-
* for nested object structures with `Promise`-based validation.
|
|
368
|
-
*
|
|
369
|
-
* @example
|
|
370
|
-
*
|
|
371
|
-
* ```typescript
|
|
372
|
-
* // Create embeddable async assertion functions
|
|
373
|
-
* const isAsyncString = expectAsync.it('to be a string');
|
|
374
|
-
* const resolvesFast = expectAsync.it('to resolve quickly');
|
|
375
|
-
*
|
|
376
|
-
* // Use within async 'to satisfy' patterns
|
|
377
|
-
* await expectAsync(asyncUser, 'to satisfy', {
|
|
378
|
-
* name: isAsyncString,
|
|
379
|
-
* loadPromise: resolvesFast,
|
|
380
|
-
* });
|
|
381
|
-
* ```
|
|
382
|
-
*
|
|
383
|
-
* @template AsyncAssertions - Array of asynchronous assertion objects that
|
|
384
|
-
* define the available assertion logic for the embeddable async functions
|
|
385
|
-
* @group Core API
|
|
386
|
-
* @see {@link ExpectItFunctionAsync} for individual function signature generation
|
|
387
|
-
* @see {@link ExpectItExecutorAsync} for the executor function interface
|
|
388
|
-
* @see {@link ExpectIt} for the synchronous equivalent
|
|
389
|
-
*/
|
|
390
|
-
export type ExpectItAsync<AsyncAssertions extends AnyAsyncAssertions = BuiltinAsyncAssertions> = UnionToIntersection<TupleToUnion<{
|
|
391
|
-
[K in keyof AsyncAssertions]: AsyncAssertions[K] extends AnyAsyncAssertion ? AsyncAssertions[K]['parts'] extends AssertionParts ? ExpectItFunctionAsync<AsyncAssertions[K]['parts']> : never : never;
|
|
392
|
-
}>>;
|
|
393
|
-
/**
|
|
394
|
-
* Interface for executor functions created by `expect.it()`.
|
|
395
|
-
*
|
|
396
|
-
* `ExpectItExecutor` functions are the result of calling `expect.it()` with
|
|
397
|
-
* assertion parameters. They encapsulate the assertion logic and can be
|
|
398
|
-
* executed later within `'to satisfy'` pattern matching contexts. These
|
|
399
|
-
* functions are marked with an internal symbol to distinguish them from regular
|
|
400
|
-
* functions during pattern validation.
|
|
401
|
-
*
|
|
402
|
-
* The executor accepts a subject value and performs the embedded assertion
|
|
403
|
-
* logic against it. The subject type is constrained by the Zod schema that
|
|
404
|
-
* represents the first part of the assertion definition, ensuring type safety
|
|
405
|
-
* during pattern matching.
|
|
406
|
-
*
|
|
407
|
-
* @example
|
|
408
|
-
*
|
|
409
|
-
* ```typescript
|
|
410
|
-
* const isStringExecutor = expect.it('to be a string');
|
|
411
|
-
* // isStringExecutor is an ExpectItExecutor<z.ZodString>
|
|
412
|
-
*
|
|
413
|
-
* // Used within satisfy patterns
|
|
414
|
-
* expect({ name: 'Alice' }, 'to satisfy', {
|
|
415
|
-
* name: isStringExecutor, // Validates that name is a string
|
|
416
|
-
* });
|
|
417
|
-
* ```
|
|
418
|
-
*
|
|
419
|
-
* @template Subject - The Zod schema type that constrains the subject parameter
|
|
420
|
-
* @group Expect-Related
|
|
421
|
-
* @see {@link ExpectItFunction} for the factory function that creates executors
|
|
422
|
-
*/
|
|
423
|
-
export interface ExpectItExecutor<Subject extends z.ZodType> {
|
|
424
|
-
(subject: z.infer<Subject>): void;
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Function signature for creating `ExpectItExecutor` instances.
|
|
428
|
-
*
|
|
429
|
-
* This type represents the factory function that creates embeddable assertion
|
|
430
|
-
* executors from assertion parts. It takes the assertion parameters (excluding
|
|
431
|
-
* the subject) and returns an executor function that can be embedded within
|
|
432
|
-
* `'to satisfy'` patterns.
|
|
433
|
-
*
|
|
434
|
-
* The function signature is derived from assertion parts by removing the first
|
|
435
|
-
* part (which becomes the subject type for the executor) and using the
|
|
436
|
-
* remaining parts as parameters. This allows for natural language assertion
|
|
437
|
-
* creation that mirrors the main `expect()` function but produces reusable
|
|
438
|
-
* executor functions.
|
|
439
|
-
*
|
|
440
|
-
* The resulting executor is constrained to only work with subjects that match
|
|
441
|
-
* the first assertion part, providing compile-time type safety for pattern
|
|
442
|
-
* matching scenarios.
|
|
443
|
-
*
|
|
444
|
-
* @example
|
|
445
|
-
*
|
|
446
|
-
* ```typescript
|
|
447
|
-
* // For assertion parts: [z.string(), 'to match', z.instanceof(RegExp)]
|
|
448
|
-
* // Results in function: (pattern: RegExp) => ExpectItExecutor<z.ZodString>
|
|
449
|
-
* const matchesPattern = expect.it('to match', /^[A-Z]/);
|
|
450
|
-
*
|
|
451
|
-
* expect({ code: 'ABC123' }, 'to satisfy', {
|
|
452
|
-
* code: matchesPattern, // Validates that code matches the pattern
|
|
453
|
-
* });
|
|
454
|
-
* ```
|
|
455
|
-
*
|
|
456
|
-
* @template Parts - Tuple of assertion parts that define the function signature
|
|
457
|
-
* and executor constraints
|
|
458
|
-
* @see {@link ExpectItExecutor} for the returned executor interface
|
|
459
|
-
* @see {@link TupleTail} for parameter extraction from assertion parts
|
|
460
|
-
* @see {@link SlotsFromParts} for type slot generation
|
|
461
|
-
*/
|
|
462
|
-
/**
|
|
463
|
-
* Interface for asynchronous executor functions created by `expectAsync.it()`.
|
|
464
|
-
*
|
|
465
|
-
* `ExpectItExecutorAsync` functions are the async equivalent of
|
|
466
|
-
* {@link ExpectItExecutor}, designed for asynchronous assertion contexts. They
|
|
467
|
-
* return `Promise`s and are marked with the same internal symbol for
|
|
468
|
-
* identification. These executors can be embedded within `'to satisfy'`
|
|
469
|
-
* patterns for async validation scenarios.
|
|
470
|
-
*
|
|
471
|
-
* @example
|
|
472
|
-
*
|
|
473
|
-
* ```typescript
|
|
474
|
-
* const isAsyncStringExecutor = expectAsync.it('to be a string');
|
|
475
|
-
* // isAsyncStringExecutor is an ExpectItExecutorAsync<z.ZodString>
|
|
476
|
-
*
|
|
477
|
-
* // Used within async satisfy patterns
|
|
478
|
-
* await expectAsync({ name: 'Alice' }, 'to satisfy', {
|
|
479
|
-
* name: isAsyncStringExecutor, // Async validation that name is a string
|
|
480
|
-
* });
|
|
481
|
-
* ```
|
|
482
|
-
*
|
|
483
|
-
* @template Subject - The Zod schema type that constrains the subject parameter
|
|
484
|
-
* @group Expect-Related
|
|
485
|
-
* @see {@link ExpectItFunctionAsync} for the factory function that creates async executors
|
|
486
|
-
* @see {@link ExpectItExecutor} for the synchronous equivalent
|
|
487
|
-
*/
|
|
488
|
-
export interface ExpectItExecutorAsync<Subject extends z.ZodType> {
|
|
489
|
-
(subject: z.infer<Subject>): Promise<void>;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* The function part of {@link ExpectIt}.
|
|
493
|
-
*/
|
|
494
|
-
export type ExpectItFunction<Parts extends AssertionParts> = (...args: MutableOrReadonly<TupleTail<SlotsFromParts<Parts>>>) => Parts[0] extends z.ZodType ? ExpectItExecutor<Parts[0]> : never;
|
|
495
|
-
/**
|
|
496
|
-
* Function signature for creating async `ExpectItExecutorAsync` instances.
|
|
497
|
-
*
|
|
498
|
-
* This type represents the factory function that creates embeddable async
|
|
499
|
-
* assertion executors from assertion parts. It takes the assertion parameters
|
|
500
|
-
* (excluding the subject) and returns an async executor function that can be
|
|
501
|
-
* embedded within async `'to satisfy'` patterns.
|
|
502
|
-
*
|
|
503
|
-
* The function signature is derived from assertion parts by removing the first
|
|
504
|
-
* part (which becomes the subject type for the executor) and using the
|
|
505
|
-
* remaining parts as parameters. This allows for natural language assertion
|
|
506
|
-
* creation that mirrors the main `expectAsync()` function but produces reusable
|
|
507
|
-
* async executor functions.
|
|
508
|
-
*
|
|
509
|
-
* @example
|
|
510
|
-
*
|
|
511
|
-
* ```typescript
|
|
512
|
-
* // For assertion parts: [z.string(), 'to match', z.instanceof(RegExp)]
|
|
513
|
-
* // Results in function: (pattern: RegExp) => ExpectItExecutorAsync<z.ZodString>
|
|
514
|
-
* const matchesPatternAsync = expectAsync.it('to match', /^[A-Z]/);
|
|
515
|
-
*
|
|
516
|
-
* await expectAsync({ code: 'ABC123' }, 'to satisfy', {
|
|
517
|
-
* code: matchesPatternAsync, // Async validation that code matches the pattern
|
|
518
|
-
* });
|
|
519
|
-
* ```
|
|
520
|
-
*
|
|
521
|
-
* @template Parts - Tuple of assertion parts that define the function signature
|
|
522
|
-
* and executor constraints
|
|
523
|
-
* @see {@link ExpectItExecutorAsync} for the returned async executor interface
|
|
524
|
-
* @see {@link ExpectItFunction} for the synchronous equivalent
|
|
525
|
-
* @see {@link TupleTail} for parameter extraction from assertion parts
|
|
526
|
-
* @see {@link SlotsFromParts} for type slot generation
|
|
527
|
-
*/
|
|
528
|
-
export type ExpectItFunctionAsync<Parts extends AssertionParts> = (...args: MutableOrReadonly<TupleTail<SlotsFromParts<Parts>>>) => Parts[0] extends z.ZodType ? ExpectItExecutorAsync<Parts[0]> : never;
|
|
529
|
-
/**
|
|
530
|
-
* Properties of {@link expect}.
|
|
531
|
-
*
|
|
532
|
-
* @group Expect-Related
|
|
533
|
-
*/
|
|
534
|
-
export interface ExpectSyncProps<SyncAssertions extends AnySyncAssertions, AsyncAssertions extends AnyAsyncAssertions> extends BaseExpect {
|
|
535
|
-
/**
|
|
536
|
-
* Tuple of all assertions available in this `expect()`.
|
|
537
|
-
*
|
|
538
|
-
* @preventExpand
|
|
539
|
-
*/
|
|
540
|
-
assertions: SyncAssertions;
|
|
541
|
-
it: ExpectIt<SyncAssertions>;
|
|
542
|
-
/**
|
|
543
|
-
* Function to add more assertions to this `expect()`, returning a new
|
|
544
|
-
* `expect()` and `expectAsync()` pair with the combined assertions.
|
|
545
|
-
*/
|
|
546
|
-
use: UseFn<SyncAssertions, AsyncAssertions>;
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* A function which immediately throws an {@link AssertionError}.
|
|
550
|
-
*
|
|
551
|
-
* Member of {@link BaseExpect}.
|
|
552
|
-
*
|
|
553
|
-
* @param reason Optional reason for failure
|
|
554
|
-
* @group Core API
|
|
555
|
-
* @see {@link fail}
|
|
556
|
-
*/
|
|
557
|
-
export type FailFn = (reason?: string) => never;
|
|
558
|
-
/**
|
|
559
|
-
* Given a mixed array of assertions, filters out only the async assertions.
|
|
560
|
-
*/
|
|
561
|
-
/**
|
|
562
|
-
* Given a mixed array of assertions, filters out only the async assertions.
|
|
563
|
-
*
|
|
564
|
-
* This utility type recursively examines each assertion in the input array and
|
|
565
|
-
* constructs a new tuple containing only the asynchronous assertions. It uses
|
|
566
|
-
* conditional types to test whether each assertion extends
|
|
567
|
-
* {@link AnyAsyncAssertion} and includes it in the result if so.
|
|
568
|
-
*
|
|
569
|
-
* Used primarily by {@link UseFn} to separate async assertions from mixed
|
|
570
|
-
* assertion arrays when composing expect functions.
|
|
571
|
-
*
|
|
572
|
-
* @example
|
|
573
|
-
*
|
|
574
|
-
* ```typescript
|
|
575
|
-
* type Mixed = [
|
|
576
|
-
* SyncAssertion1,
|
|
577
|
-
* AsyncAssertion1,
|
|
578
|
-
* SyncAssertion2,
|
|
579
|
-
* AsyncAssertion2,
|
|
580
|
-
* ];
|
|
581
|
-
* type AsyncOnly = FilterAsyncAssertions<Mixed>; // [AsyncAssertion1, AsyncAssertion2]
|
|
582
|
-
* ```
|
|
583
|
-
*
|
|
584
|
-
* @template MixedAssertions - Array that may contain both sync and async
|
|
585
|
-
* assertions
|
|
586
|
-
* @see {@link FilterSyncAssertions} for extracting synchronous assertions
|
|
587
|
-
* @see {@link UseFn} for the primary use case of this type
|
|
588
|
-
*/
|
|
589
|
-
export type FilterAsyncAssertions<MixedAssertions extends readonly AnyAssertion[]> = MixedAssertions extends readonly [
|
|
590
|
-
infer MixedAssertion extends AnyAssertion,
|
|
591
|
-
...infer Rest extends readonly AnyAssertion[]
|
|
592
|
-
] ? MixedAssertion extends AnyAsyncAssertion ? readonly [MixedAssertion, ...FilterAsyncAssertions<Rest>] : FilterAsyncAssertions<Rest> : readonly [];
|
|
593
|
-
/**
|
|
594
|
-
* Given a mixed array of assertions, extracts only the synchronous assertions.
|
|
595
|
-
*/
|
|
596
|
-
export type FilterSyncAssertions<MixedAssertions extends readonly AnyAssertion[]> = MixedAssertions extends readonly [
|
|
597
|
-
infer MixedAssertion extends AnyAssertion,
|
|
598
|
-
...infer Rest extends readonly AnyAssertion[]
|
|
599
|
-
] ? MixedAssertion extends AnySyncAssertion ? readonly [MixedAssertion, ...FilterSyncAssertions<Rest>] : FilterSyncAssertions<Rest> : readonly [];
|
|
600
|
-
/**
|
|
601
|
-
* Options for test data generation.
|
|
602
|
-
*/
|
|
603
|
-
export interface GeneratorOptions {
|
|
604
|
-
/** Whether to include edge cases (NaN, Infinity, etc.) */
|
|
605
|
-
includeEdgeCases?: boolean;
|
|
606
|
-
/** Maximum array size */
|
|
607
|
-
maxArrayLength?: number;
|
|
608
|
-
/** Maximum nesting depth for recursive structures */
|
|
609
|
-
maxDepth?: number;
|
|
610
|
-
/** Maximum object property count */
|
|
611
|
-
maxObjectProperties?: number;
|
|
612
|
-
/** Optional seed for reproducible generation */
|
|
613
|
-
seedValue?: number;
|
|
614
|
-
}
|
|
615
|
-
/**
|
|
616
|
-
* Represents a dot-notation or bracket-notation keypath for accessing nested
|
|
617
|
-
* object properties.
|
|
618
|
-
*
|
|
619
|
-
* @group Utility Types
|
|
620
|
-
*/
|
|
621
|
-
export type Keypath<S extends string = string> = S extends `${infer K}.${infer Rest}` ? K extends string ? Rest extends string ? `${K}.${Keypath<Rest>}` : never : never : S extends `${infer K}[${infer Index}]${infer Rest}` ? K extends string ? Index extends `"${string}"` | `${number}` | `'${string}'` ? Rest extends '' ? `${K}[${Index}]` : Rest extends `.${infer RestPath}` ? `${K}[${Index}].${Keypath<RestPath>}` : Rest extends `[${infer NextIndex}]${infer RestPath}` ? `${K}[${Index}][${NextIndex}]${RestPath extends '' ? '' : Keypath<RestPath>}` : never : never : never : S;
|
|
622
|
-
/**
|
|
623
|
-
* Maps `AssertionParts` to the corresponding argument types for `expect` and
|
|
624
|
-
* `expectAsync` functions.
|
|
625
|
-
*
|
|
626
|
-
* This utility type transforms assertion parts into the actual parameter types
|
|
627
|
-
* that users provide when calling expect functions. It handles both phrase
|
|
628
|
-
* literals and Zod schemas, creating appropriate `TypeScript` types for each
|
|
629
|
-
* slot.
|
|
630
|
-
*
|
|
631
|
-
* For phrase literals, it creates union types that include both the original
|
|
632
|
-
* phrase and its negated version (with `"not "` prefix). For Zod schemas, it
|
|
633
|
-
* extracts the inferred type. This enables natural language assertions with
|
|
634
|
-
* optional negation support.
|
|
635
|
-
*
|
|
636
|
-
* @remarks
|
|
637
|
-
* This type works recursively through the parts tuple, transforming each part
|
|
638
|
-
* according to its type. The resulting tuple maintains the same structure as
|
|
639
|
-
* the input but with user-facing `TypeScript` types instead of internal
|
|
640
|
-
* assertion part types.
|
|
641
|
-
* @example
|
|
642
|
-
*
|
|
643
|
-
* ```typescript
|
|
644
|
-
* // Given parts: ['to be a', z.string()]
|
|
645
|
-
* // Results in: ['to be a' | 'not to be a', string]
|
|
646
|
-
* type Slots = MapExpectSlots<['to be a', z.string()]>;
|
|
647
|
-
* // Usage: expect(value, 'to be a', 'hello') or expect(value, 'not to be a', 'hello')
|
|
648
|
-
* ```
|
|
649
|
-
*
|
|
650
|
-
* @template Parts - Tuple of assertion parts to be converted to function
|
|
651
|
-
* parameter types
|
|
652
|
-
* @see {@link SlotsFromParts} for the complete slot transformation including subject injection
|
|
653
|
-
* @see {@link Negation} for how phrase negation is implemented
|
|
654
|
-
*/
|
|
655
|
-
export type MapExpectSlots<Parts extends readonly AssertionPart[]> = Parts extends readonly [
|
|
656
|
-
infer First extends AssertionPart,
|
|
657
|
-
...infer Rest extends readonly AssertionPart[]
|
|
658
|
-
] ? readonly [
|
|
659
|
-
AssertionSlot<First> extends PhraseLiteralSlot<infer StringLiteral> ? Negation<StringLiteral> | StringLiteral : AssertionSlot<First> extends PhraseLiteralChoiceSlot<infer StringLiterals> ? ArrayValues<StringLiterals> | Negation<ArrayValues<StringLiterals>> : AssertionSlot<First> extends z.ZodType ? z.infer<AssertionSlot<First>> : never,
|
|
660
|
-
...MapExpectSlots<Rest>
|
|
661
|
-
] : readonly [];
|
|
662
|
-
/**
|
|
663
|
-
* @groupDescription Benchmark Types
|
|
664
|
-
* Types for valueToSchema() benchmark functionality.
|
|
665
|
-
*/
|
|
666
|
-
/**
|
|
667
|
-
* Memory usage statistics.
|
|
668
|
-
*/
|
|
669
|
-
export interface MemoryStats {
|
|
670
|
-
/** External memory */
|
|
671
|
-
external: number;
|
|
672
|
-
/** Total heap memory */
|
|
673
|
-
heapTotal: number;
|
|
674
|
-
/** Heap memory used */
|
|
675
|
-
heapUsed: number;
|
|
676
|
-
}
|
|
677
|
-
/**
|
|
678
|
-
* Makes tuple types accept both mutable and readonly variants.
|
|
679
|
-
*
|
|
680
|
-
* This utility type creates a union of both mutable and readonly versions of a
|
|
681
|
-
* tuple type, providing flexibility for function parameters that should accept
|
|
682
|
-
* either variant. This is particularly useful for assertion function parameters
|
|
683
|
-
* where users may pass either `const` arrays (readonly) or regular arrays.
|
|
684
|
-
*
|
|
685
|
-
* The type handles both array types and specific tuple types, creating
|
|
686
|
-
* appropriate unions for each case to maintain type safety while maximizing
|
|
687
|
-
* usability.
|
|
688
|
-
*
|
|
689
|
-
* @example
|
|
690
|
-
*
|
|
691
|
-
* ```typescript
|
|
692
|
-
* type FlexibleArgs = MutableOrReadonly<readonly [string, number]>;
|
|
693
|
-
* // Results in: [string, number] | readonly [string, number]
|
|
694
|
-
*
|
|
695
|
-
* function acceptArgs(args: FlexibleArgs) { ... }
|
|
696
|
-
* acceptArgs(['hello', 42]); // ✓ mutable array
|
|
697
|
-
* acceptArgs(['hello', 42] as const); // ✓ readonly array
|
|
698
|
-
* ```
|
|
699
|
-
*
|
|
700
|
-
* @template Tuple - The readonly tuple type to make flexible
|
|
701
|
-
* @group Utility Types
|
|
702
|
-
* @see {@link ExpectFunction} and {@link ExpectAsyncFunction} which use this for parameter flexibility
|
|
703
|
-
*/
|
|
704
|
-
export type MutableOrReadonly<Tuple extends readonly unknown[]> = Tuple extends readonly (infer Item)[] ? Item[] | readonly Item[] : Tuple extends readonly [infer First, ...infer Rest] ? [First, ...Rest] | readonly [First, ...Rest] : Tuple;
|
|
705
|
-
/**
|
|
706
|
-
* Creates a negated version of a phrase literal by prefixing `"not "`.
|
|
707
|
-
*
|
|
708
|
-
* This utility type transforms assertion phrases into their negated
|
|
709
|
-
* equivalents, enabling the natural language negation feature in <span
|
|
710
|
-
* class="bupkis">BUPKIS</span> assertions. When users provide phrases like
|
|
711
|
-
* `"not to be a string"`, this type helps the system understand and process the
|
|
712
|
-
* negation.
|
|
713
|
-
*
|
|
714
|
-
* The negation is applied at the type level during assertion matching and
|
|
715
|
-
* affects how the assertion logic is executed - negated assertions expect the
|
|
716
|
-
* opposite result.
|
|
717
|
-
*
|
|
718
|
-
* @example
|
|
719
|
-
*
|
|
720
|
-
* ```typescript
|
|
721
|
-
* type Negated = Negation<'to be a string'>; // "not to be a string"
|
|
722
|
-
* type AlsoNegated = Negation<'to equal'>; // "not to equal"
|
|
723
|
-
*
|
|
724
|
-
* // Usage in assertions:
|
|
725
|
-
* expect(42, 'not to be a string'); // Uses negated assertion logic
|
|
726
|
-
* ```
|
|
727
|
-
*
|
|
728
|
-
* @template S - The string literal phrase to be negated
|
|
729
|
-
* @see {@link AddNegation} for applying negation to entire `AssertionParts` tuples
|
|
730
|
-
* @see {@link MapExpectSlots} for how negation is incorporated into function signatures
|
|
731
|
-
*/
|
|
732
|
-
export type Negation<S extends string> = `not ${S}`;
|
|
733
|
-
/**
|
|
734
|
-
* Performance analysis results.
|
|
735
|
-
*/
|
|
736
|
-
export interface PerformanceAnalysis {
|
|
737
|
-
/** Identified bottlenecks */
|
|
738
|
-
bottlenecks: Array<{
|
|
739
|
-
category: string;
|
|
740
|
-
impact: 'high' | 'low' | 'medium';
|
|
741
|
-
opsPerSecond: number;
|
|
742
|
-
reason: string;
|
|
743
|
-
}>;
|
|
744
|
-
/** Statistical outliers */
|
|
745
|
-
outliers: Array<{
|
|
746
|
-
category: string;
|
|
747
|
-
deviation: number;
|
|
748
|
-
options: ValueToSchemaOptions;
|
|
749
|
-
value: number;
|
|
750
|
-
}>;
|
|
751
|
-
/** Summary statistics */
|
|
752
|
-
summary: {
|
|
753
|
-
averageOpsPerSecond: number;
|
|
754
|
-
fastestCategory: string;
|
|
755
|
-
slowestCategory: string;
|
|
756
|
-
totalExecutionTime: number;
|
|
757
|
-
};
|
|
758
|
-
/** Performance trends */
|
|
759
|
-
trends: Array<{
|
|
760
|
-
description: string;
|
|
761
|
-
factor: string;
|
|
762
|
-
impact: number;
|
|
763
|
-
}>;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Performance metrics for a benchmark run.
|
|
767
|
-
*/
|
|
768
|
-
export interface PerformanceMetrics {
|
|
769
|
-
/** Timing statistics */
|
|
770
|
-
executionTime: ExecutionTimeStats;
|
|
771
|
-
/** Category of input being measured */
|
|
772
|
-
inputCategory: string;
|
|
773
|
-
/** Memory allocation data (if available) */
|
|
774
|
-
memoryUsage?: MemoryStats;
|
|
775
|
-
/** Throughput measurement (operations per second) */
|
|
776
|
-
operationsPerSecond: number;
|
|
777
|
-
/** Configuration used for this measurement */
|
|
778
|
-
options: ValueToSchemaOptions;
|
|
779
|
-
/** When measurement was taken */
|
|
780
|
-
timestamp: Date;
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* Converts `AssertionParts` to complete function parameter types for expect
|
|
784
|
-
* functions.
|
|
785
|
-
*
|
|
786
|
-
* This utility type prepares assertion parts for use as function parameters by
|
|
787
|
-
* applying several transformations:
|
|
788
|
-
*
|
|
789
|
-
* 1. Injects an `unknown` type for the subject parameter if the first part is a
|
|
790
|
-
* phrase literal
|
|
791
|
-
* 2. Maps the remaining parts to their corresponding `TypeScript` types via
|
|
792
|
-
* {@link MapExpectSlots}
|
|
793
|
-
* 3. Filters out `never` types to ensure a clean tuple structure
|
|
794
|
-
*
|
|
795
|
-
* The subject injection is a key feature - when assertions start with phrases
|
|
796
|
-
* like `"to be a string"`, users still need to provide the subject being tested
|
|
797
|
-
* as the first argument to expect functions.
|
|
798
|
-
*
|
|
799
|
-
* @remarks
|
|
800
|
-
* This type is essential for bridging the gap between assertion definitions and
|
|
801
|
-
* user-facing function signatures. The subject injection ensures that all
|
|
802
|
-
* assertions have a consistent calling pattern regardless of whether they
|
|
803
|
-
* explicitly define a subject parameter.
|
|
804
|
-
* @example
|
|
805
|
-
*
|
|
806
|
-
* ```typescript
|
|
807
|
-
* // Assertion parts: ['to equal', z.string()]
|
|
808
|
-
* // Results in: [unknown, 'to equal' | 'not to equal', string]
|
|
809
|
-
* type Slots = SlotsFromParts<['to equal', z.string()]>;
|
|
810
|
-
*
|
|
811
|
-
* // Usage: expect(subject, 'to equal', 'expected')
|
|
812
|
-
* // expect(subject, 'not to equal', 'unexpected')
|
|
813
|
-
* ```
|
|
814
|
-
*
|
|
815
|
-
* @template Parts - Tuple of assertion parts that define the assertion
|
|
816
|
-
* structure
|
|
817
|
-
* @group Expect-Related
|
|
818
|
-
* @see {@link MapExpectSlots} for the core slot mapping logic
|
|
819
|
-
* @see {@link NoNeverTuple} for never-type filtering
|
|
820
|
-
*/
|
|
821
|
-
export type SlotsFromParts<Parts extends AssertionParts> = NoNeverTuple<Parts extends readonly [infer First extends AssertionPart, ...infer _] ? First extends PhraseLiteral | PhraseLiteralChoice ? [unknown, ...MapExpectSlots<Parts>] : MapExpectSlots<Parts> : never>;
|
|
822
|
-
/**
|
|
823
|
-
* Gets the tail (all elements except the first) of a tuple type.
|
|
824
|
-
*
|
|
825
|
-
* Unlike ArrayTail from type-fest, this preserves the tuple structure as a
|
|
826
|
-
* readonly tuple rather than converting to an array type.
|
|
827
|
-
*
|
|
828
|
-
* @example
|
|
829
|
-
*
|
|
830
|
-
* ```typescript
|
|
831
|
-
* type Example = TupleTail<readonly [string, number, boolean]>; // readonly [number, boolean]
|
|
832
|
-
* type Single = TupleTail<readonly [string]>; // readonly []
|
|
833
|
-
* type Empty = TupleTail<readonly []>; // readonly []
|
|
834
|
-
* ```
|
|
835
|
-
*
|
|
836
|
-
* @template T - The tuple type to get the tail of
|
|
837
|
-
* @group Utility Types
|
|
838
|
-
*/
|
|
839
|
-
export type TupleTail<T extends readonly unknown[]> = T extends readonly [
|
|
840
|
-
unknown,
|
|
841
|
-
...infer Rest
|
|
842
|
-
] ? Rest : readonly [];
|
|
843
|
-
/**
|
|
844
|
-
* The type of a `use()` function.
|
|
845
|
-
*
|
|
846
|
-
* @group Core API
|
|
847
|
-
*/
|
|
848
|
-
export interface UseFn<BaseSyncAssertions extends AnySyncAssertions, BaseAsyncAssertions extends AnyAsyncAssertions> {
|
|
849
|
-
/**
|
|
850
|
-
* @template MixedAssertions Mixed set of assertions to add; may include both
|
|
851
|
-
* sync and async assertions
|
|
852
|
-
* @template ExtendedSyncAssertions Synchronous assertions extracted from
|
|
853
|
-
* `MixedAssertions`
|
|
854
|
-
* @template ExtendedAsyncAssertions Asynchronous assertions extracted from
|
|
855
|
-
* `MixedAssertions`
|
|
856
|
-
* @param assertions Array of assertion classes to add
|
|
857
|
-
* @returns New {@link expect} and {@link expectAsync} functions with the
|
|
858
|
-
* combined assertions
|
|
859
|
-
*/
|
|
860
|
-
<MixedAssertions extends readonly AnyAssertion[], ExtendedSyncAssertions extends FilterSyncAssertions<MixedAssertions>, ExtendedAsyncAssertions extends FilterAsyncAssertions<MixedAssertions>>(assertions: MixedAssertions): Bupkis<BaseSyncAssertions, BaseAsyncAssertions, ExtendedSyncAssertions, ExtendedAsyncAssertions>;
|
|
861
|
-
}
|
|
862
|
-
/**
|
|
863
|
-
* Maps Zod `def.type` strings to their corresponding `ZodType` classes.
|
|
864
|
-
*
|
|
865
|
-
* This allows for type-safe discrimination of `ZodType`s based on their
|
|
866
|
-
* internal `def.type` property in Zod v4.
|
|
867
|
-
*
|
|
868
|
-
* @group Utility Types
|
|
869
|
-
*/
|
|
870
|
-
export interface ZodTypeMap {
|
|
871
|
-
any: z.ZodAny;
|
|
872
|
-
array: z.ZodArray;
|
|
873
|
-
bigint: z.ZodBigInt;
|
|
874
|
-
boolean: z.ZodBoolean;
|
|
875
|
-
catch: z.ZodCatch;
|
|
876
|
-
custom: z.ZodCustom;
|
|
877
|
-
date: z.ZodDate;
|
|
878
|
-
default: z.ZodDefault;
|
|
879
|
-
enum: z.ZodEnum;
|
|
880
|
-
function: z.ZodFunction;
|
|
881
|
-
intersection: z.ZodIntersection;
|
|
882
|
-
lazy: z.ZodLazy;
|
|
883
|
-
literal: z.ZodLiteral;
|
|
884
|
-
map: z.ZodMap;
|
|
885
|
-
never: z.ZodNever;
|
|
886
|
-
nonoptional: z.ZodNonOptional;
|
|
887
|
-
null: z.ZodNull;
|
|
888
|
-
nullable: z.ZodNullable;
|
|
889
|
-
number: z.ZodNumber;
|
|
890
|
-
object: z.ZodObject;
|
|
891
|
-
optional: z.ZodOptional;
|
|
892
|
-
pipe: z.ZodPipe;
|
|
893
|
-
promise: z.ZodPromise;
|
|
894
|
-
readonly: z.ZodReadonly;
|
|
895
|
-
record: z.ZodRecord;
|
|
896
|
-
set: z.ZodSet;
|
|
897
|
-
string: z.ZodString;
|
|
898
|
-
symbol: z.ZodSymbol;
|
|
899
|
-
tuple: z.ZodTuple;
|
|
900
|
-
undefined: z.ZodUndefined;
|
|
901
|
-
union: z.ZodUnion;
|
|
902
|
-
unknown: z.ZodUnknown;
|
|
903
|
-
void: z.ZodVoid;
|
|
904
|
-
}
|
|
905
|
-
//# sourceMappingURL=types.d.ts.map
|