From cbc9370a2a391d599fd16062432d779d46a427fc Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 24 Dec 2024 20:07:57 +0800 Subject: [PATCH 1/4] perf: mark functions as `@__NO_SIDE_EFFECTS__` --- library/.eslintrc.cjs | 2 +- library/src/actions/args/args.ts | 1 + library/src/actions/args/argsAsync.ts | 1 + library/src/actions/await/awaitAsync.ts | 2 ++ library/src/actions/base64/base64.ts | 1 + library/src/actions/bic/bic.ts | 1 + library/src/actions/brand/brand.ts | 2 ++ library/src/actions/bytes/bytes.ts | 1 + library/src/actions/check/check.ts | 1 + library/src/actions/check/checkAsync.ts | 1 + library/src/actions/checkItems/checkItems.ts | 1 + library/src/actions/checkItems/checkItemsAsync.ts | 1 + library/src/actions/creditCard/creditCard.ts | 1 + library/src/actions/cuid2/cuid2.ts | 1 + library/src/actions/decimal/decimal.ts | 1 + library/src/actions/description/description.ts | 2 ++ library/src/actions/digits/digits.ts | 1 + library/src/actions/email/email.ts | 1 + library/src/actions/emoji/emoji.ts | 1 + library/src/actions/empty/empty.ts | 1 + library/src/actions/endsWith/endsWith.ts | 1 + library/src/actions/everyItem/everyItem.ts | 1 + library/src/actions/excludes/excludes.ts | 1 + library/src/actions/finite/finite.ts | 1 + library/src/actions/graphemes/graphemes.ts | 1 + library/src/actions/hash/hash.ts | 1 + library/src/actions/hexColor/hexColor.ts | 1 + library/src/actions/hexadecimal/hexadecimal.ts | 1 + library/src/actions/imei/imei.ts | 1 + library/src/actions/includes/includes.ts | 1 + library/src/actions/integer/integer.ts | 1 + library/src/actions/ip/ip.ts | 1 + library/src/actions/ipv4/ipv4.ts | 1 + library/src/actions/ipv6/ipv6.ts | 1 + library/src/actions/isoDate/isoDate.ts | 1 + library/src/actions/isoDateTime/isoDateTime.ts | 1 + library/src/actions/isoTime/isoTime.ts | 1 + library/src/actions/isoTimeSecond/isoTimeSecond.ts | 1 + library/src/actions/isoTimestamp/isoTimestamp.ts | 1 + library/src/actions/isoWeek/isoWeek.ts | 1 + library/src/actions/length/length.ts | 1 + library/src/actions/mac/mac.ts | 1 + library/src/actions/mac48/mac48.ts | 1 + library/src/actions/mac64/mac64.ts | 1 + library/src/actions/mapItems/mapItems.ts | 1 + library/src/actions/maxBytes/maxBytes.ts | 1 + library/src/actions/maxGraphemes/maxGraphemes.ts | 1 + library/src/actions/maxLength/maxLength.ts | 1 + library/src/actions/maxSize/maxSize.ts | 1 + library/src/actions/maxValue/maxValue.ts | 1 + library/src/actions/maxWords/maxWords.ts | 1 + library/src/actions/minBytes/minBytes.ts | 1 + library/src/actions/minLength/minLength.ts | 1 + library/src/actions/minSize/minSize.ts | 1 + library/src/actions/minWords/minWords.ts | 1 + library/src/actions/multipleOf/multipleOf.ts | 1 + library/src/actions/nanoid/nanoid.ts | 1 + library/src/actions/nonEmpty/nonEmpty.ts | 1 + library/src/actions/normalize/normalize.ts | 1 + library/src/actions/notBytes/notBytes.ts | 1 + library/src/actions/notGraphemes/notGraphemes.ts | 1 + library/src/actions/notLength/notLength.ts | 1 + library/src/actions/notValue/notValue.ts | 1 + library/src/actions/notWords/notWords.ts | 1 + library/src/actions/octal/octal.ts | 1 + library/src/actions/partialCheck/partialCheck.ts | 1 + library/src/actions/partialCheck/partialCheckAsync.ts | 1 + library/src/actions/rawCheck/rawCheck.ts | 2 ++ library/src/actions/rawCheck/rawCheckAsync.ts | 2 ++ library/src/actions/rawTransform/rawTransform.ts | 2 ++ library/src/actions/rawTransform/rawTransformAsync.ts | 2 ++ library/src/actions/readonly/readonly.ts | 2 ++ library/src/actions/reduceItems/reduceItems.ts | 1 + library/src/actions/regex/regex.ts | 1 + library/src/actions/returns/returns.ts | 1 + library/src/actions/returns/returnsAsync.ts | 1 + library/src/actions/safeInteger/safeInteger.ts | 1 + library/src/actions/size/size.ts | 1 + library/src/actions/someItem/someItem.ts | 1 + library/src/actions/sortItems/sortItems.ts | 1 + library/src/actions/startsWith/startsWith.ts | 1 + library/src/actions/title/title.ts | 2 ++ library/src/actions/toLowerCase/toLowerCase.ts | 2 ++ library/src/actions/toMaxValue/toMaxValue.ts | 2 ++ library/src/actions/toMinValue/toMinValue.ts | 2 ++ library/src/actions/toUpperCase/toUpperCase.ts | 2 ++ library/src/actions/transform/transform.ts | 2 ++ library/src/actions/transform/transformAsync.ts | 2 ++ library/src/actions/trim/trim.ts | 2 ++ library/src/actions/trimEnd/trimEnd.ts | 2 ++ library/src/actions/ulid/ulid.ts | 1 + library/src/actions/url/url.ts | 1 + library/src/actions/uuid/uuid.ts | 1 + library/src/actions/value/value.ts | 1 + library/src/actions/words/words.ts | 1 + library/src/methods/assert/assert.ts | 2 ++ library/src/methods/config/config.ts | 2 ++ library/src/methods/fallback/fallback.ts | 2 ++ library/src/methods/fallback/fallbackAsync.ts | 2 ++ library/src/methods/flatten/flatten.ts | 1 + library/src/methods/forward/forward.ts | 2 ++ library/src/methods/forward/forwardAsync.ts | 2 ++ library/src/methods/getDefault/getDefault.ts | 2 ++ library/src/methods/getDefaults/getDefaults.ts | 2 ++ library/src/methods/getFallbacks/getFallbacks.ts | 2 ++ library/src/methods/is/is.ts | 2 ++ library/src/methods/keyof/keyof.ts | 1 + library/src/methods/omit/omit.ts | 2 ++ library/src/methods/parse/parse.ts | 2 ++ library/src/methods/parser/parser.ts | 1 + library/src/methods/parser/parserAsync.ts | 1 + library/src/methods/partial/partial.ts | 1 + library/src/methods/partial/partialAsync.ts | 1 + library/src/methods/pick/pick.ts | 2 ++ library/src/methods/pipe/pipe.ts | 1 + library/src/methods/pipe/pipeAsync.ts | 1 + library/src/methods/required/required.ts | 1 + library/src/methods/required/requiredAsync.ts | 1 + library/src/methods/safeParse/safeParse.ts | 2 ++ library/src/methods/safeParser/safeParser.ts | 1 + library/src/methods/safeParser/safeParserAsync.ts | 1 + library/src/methods/unwrap/unwrap.ts | 2 ++ library/src/schemas/any/any.ts | 2 ++ library/src/schemas/array/array.ts | 1 + library/src/schemas/array/arrayAsync.ts | 1 + library/src/schemas/bigint/bigint.ts | 1 + library/src/schemas/blob/blob.ts | 1 + library/src/schemas/boolean/boolean.ts | 1 + library/src/schemas/custom/custom.ts | 1 + library/src/schemas/custom/customAsync.ts | 1 + library/src/schemas/date/date.ts | 1 + library/src/schemas/enum/enum.ts | 1 + library/src/schemas/file/file.ts | 1 + library/src/schemas/function/function.ts | 1 + library/src/schemas/instance/instance.ts | 1 + library/src/schemas/intersect/intersect.ts | 1 + library/src/schemas/intersect/intersectAsync.ts | 1 + library/src/schemas/lazy/lazy.ts | 2 ++ library/src/schemas/lazy/lazyAsync.ts | 2 ++ library/src/schemas/literal/literal.ts | 1 + library/src/schemas/looseObject/looseObject.ts | 1 + library/src/schemas/looseObject/looseObjectAsync.ts | 1 + library/src/schemas/looseTuple/looseTuple.ts | 1 + library/src/schemas/looseTuple/looseTupleAsync.ts | 1 + library/src/schemas/map/map.ts | 1 + library/src/schemas/map/mapAsync.ts | 1 + library/src/schemas/nan/nan.ts | 1 + library/src/schemas/never/never.ts | 1 + library/src/schemas/nonNullable/nonNullable.ts | 1 + library/src/schemas/nonNullable/nonNullableAsync.ts | 1 + library/src/schemas/nonNullish/nonNullish.ts | 1 + library/src/schemas/nonNullish/nonNullishAsync.ts | 1 + library/src/schemas/nonOptional/nonOptional.ts | 1 + library/src/schemas/nonOptional/nonOptionalAsync.ts | 1 + library/src/schemas/null/null.ts | 1 + library/src/schemas/nullable/nullable.ts | 1 + library/src/schemas/nullable/nullableAsync.ts | 1 + library/src/schemas/nullish/nullish.ts | 1 + library/src/schemas/nullish/nullishAsync.ts | 1 + library/src/schemas/number/number.ts | 1 + library/src/schemas/object/object.ts | 1 + library/src/schemas/object/objectAsync.ts | 1 + library/src/schemas/objectWithRest/objectWithRest.ts | 1 + library/src/schemas/objectWithRest/objectWithRestAsync.ts | 1 + library/src/schemas/optional/optional.ts | 1 + library/src/schemas/picklist/picklist.ts | 1 + library/src/schemas/promise/promise.ts | 1 + library/src/schemas/record/record.ts | 1 + library/src/schemas/record/recordAsync.ts | 1 + library/src/schemas/set/set.ts | 1 + library/src/schemas/set/setAsync.ts | 1 + library/src/schemas/strictObject/strictObject.ts | 1 + library/src/schemas/strictObject/strictObjectAsync.ts | 1 + library/src/schemas/strictTuple/strictTuple.ts | 1 + library/src/schemas/strictTuple/strictTupleAsync.ts | 1 + library/src/schemas/string/string.ts | 1 + library/src/schemas/symbol/symbol.ts | 1 + library/src/schemas/tuple/tuple.ts | 1 + library/src/schemas/tuple/tupleAsync.ts | 1 + library/src/schemas/tupleWithRest/tupleWithRest.ts | 1 + library/src/schemas/tupleWithRest/tupleWithRestAsync.ts | 1 + library/src/schemas/undefined/undefined.ts | 1 + library/src/schemas/undefinedable/undefinedable.ts | 1 + library/src/schemas/undefinedable/undefinedableAsync.ts | 1 + library/src/schemas/union/union.ts | 1 + library/src/schemas/union/unionAsync.ts | 1 + library/src/schemas/unknown/unknown.ts | 2 ++ library/src/schemas/variant/variant.ts | 1 + library/src/schemas/variant/variantAsync.ts | 1 + library/src/schemas/void/void.ts | 1 + 190 files changed, 226 insertions(+), 1 deletion(-) diff --git a/library/.eslintrc.cjs b/library/.eslintrc.cjs index 6231e329d..67e9cf250 100644 --- a/library/.eslintrc.cjs +++ b/library/.eslintrc.cjs @@ -50,7 +50,7 @@ module.exports = { 'jsdoc/check-tag-names': [ 'error', { - definedTags: ['alpha', 'beta'], + definedTags: ['alpha', 'beta', '__NO_SIDE_EFFECTS__'], }, ], diff --git a/library/src/actions/args/args.ts b/library/src/actions/args/args.ts index 31883c53f..4d8da870d 100644 --- a/library/src/actions/args/args.ts +++ b/library/src/actions/args/args.ts @@ -74,6 +74,7 @@ export function args< TSchema extends Schema, >(schema: TSchema): ArgsAction; +// @__NO_SIDE_EFFECTS__ export function args( schema: Schema ): ArgsAction<(...args: unknown[]) => unknown, Schema> { diff --git a/library/src/actions/args/argsAsync.ts b/library/src/actions/args/argsAsync.ts index 03519d9b8..39daf62ed 100644 --- a/library/src/actions/args/argsAsync.ts +++ b/library/src/actions/args/argsAsync.ts @@ -96,6 +96,7 @@ export function argsAsync< TSchema extends Schema, >(schema: TSchema): ArgsActionAsync; +// @__NO_SIDE_EFFECTS__ export function argsAsync( schema: Schema ): ArgsActionAsync<(...args: unknown[]) => unknown, Schema> { diff --git a/library/src/actions/await/awaitAsync.ts b/library/src/actions/await/awaitAsync.ts index 070ac7239..2dee23e8d 100644 --- a/library/src/actions/await/awaitAsync.ts +++ b/library/src/actions/await/awaitAsync.ts @@ -22,6 +22,8 @@ export interface AwaitActionAsync> * Creates an await transformation action. * * @returns An await action. + * + * @__NO_SIDE_EFFECTS__ */ export function awaitAsync< TInput extends Promise, diff --git a/library/src/actions/base64/base64.ts b/library/src/actions/base64/base64.ts index 0de798b53..79dd65d0f 100644 --- a/library/src/actions/base64/base64.ts +++ b/library/src/actions/base64/base64.ts @@ -83,6 +83,7 @@ export function base64< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): Base64Action; +// @__NO_SIDE_EFFECTS__ export function base64( message?: ErrorMessage> ): Base64Action> | undefined> { diff --git a/library/src/actions/bic/bic.ts b/library/src/actions/bic/bic.ts index 6c06d7dcc..f90ea0e73 100644 --- a/library/src/actions/bic/bic.ts +++ b/library/src/actions/bic/bic.ts @@ -80,6 +80,7 @@ export function bic< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): BicAction; +// @__NO_SIDE_EFFECTS__ export function bic( message?: ErrorMessage> ): BicAction> | undefined> { diff --git a/library/src/actions/brand/brand.ts b/library/src/actions/brand/brand.ts index 3c5240fa4..d095b6d17 100644 --- a/library/src/actions/brand/brand.ts +++ b/library/src/actions/brand/brand.ts @@ -42,6 +42,8 @@ export interface BrandAction * @param name The brand name. * * @returns A brand action. + * + * @__NO_SIDE_EFFECTS__ */ export function brand( name: TName diff --git a/library/src/actions/bytes/bytes.ts b/library/src/actions/bytes/bytes.ts index 7e45e9806..4b8c416dc 100644 --- a/library/src/actions/bytes/bytes.ts +++ b/library/src/actions/bytes/bytes.ts @@ -92,6 +92,7 @@ export function bytes< message: TMessage ): BytesAction; +// @__NO_SIDE_EFFECTS__ export function bytes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/check/check.ts b/library/src/actions/check/check.ts index 9996ed554..c4607e932 100644 --- a/library/src/actions/check/check.ts +++ b/library/src/actions/check/check.ts @@ -58,6 +58,7 @@ export function check< message: TMessage ): CheckAction; +// @__NO_SIDE_EFFECTS__ export function check( requirement: (input: unknown) => boolean, message?: ErrorMessage> diff --git a/library/src/actions/check/checkAsync.ts b/library/src/actions/check/checkAsync.ts index 6003f7570..6a80979f2 100644 --- a/library/src/actions/check/checkAsync.ts +++ b/library/src/actions/check/checkAsync.ts @@ -62,6 +62,7 @@ export function checkAsync< message: TMessage ): CheckActionAsync; +// @__NO_SIDE_EFFECTS__ export function checkAsync( requirement: (input: unknown) => MaybePromise, message?: ErrorMessage> diff --git a/library/src/actions/checkItems/checkItems.ts b/library/src/actions/checkItems/checkItems.ts index c911a7b39..d07ffcbe0 100644 --- a/library/src/actions/checkItems/checkItems.ts +++ b/library/src/actions/checkItems/checkItems.ts @@ -59,6 +59,7 @@ export function checkItems< message: TMessage ): CheckItemsAction; +// @__NO_SIDE_EFFECTS__ export function checkItems( requirement: ArrayRequirement, message?: ErrorMessage> diff --git a/library/src/actions/checkItems/checkItemsAsync.ts b/library/src/actions/checkItems/checkItemsAsync.ts index f62d7fb23..81e8387ed 100644 --- a/library/src/actions/checkItems/checkItemsAsync.ts +++ b/library/src/actions/checkItems/checkItemsAsync.ts @@ -59,6 +59,7 @@ export function checkItemsAsync< message: TMessage ): CheckItemsActionAsync; +// @__NO_SIDE_EFFECTS__ export function checkItemsAsync( requirement: ArrayRequirementAsync, message?: ErrorMessage> diff --git a/library/src/actions/creditCard/creditCard.ts b/library/src/actions/creditCard/creditCard.ts index 7723f9a61..a247ec8de 100644 --- a/library/src/actions/creditCard/creditCard.ts +++ b/library/src/actions/creditCard/creditCard.ts @@ -114,6 +114,7 @@ export function creditCard< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): CreditCardAction; +// @__NO_SIDE_EFFECTS__ export function creditCard( message?: ErrorMessage> ): CreditCardAction> | undefined> { diff --git a/library/src/actions/cuid2/cuid2.ts b/library/src/actions/cuid2/cuid2.ts index ecf0e97c4..e39929fb1 100644 --- a/library/src/actions/cuid2/cuid2.ts +++ b/library/src/actions/cuid2/cuid2.ts @@ -80,6 +80,7 @@ export function cuid2< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): Cuid2Action; +// @__NO_SIDE_EFFECTS__ export function cuid2( message?: ErrorMessage> ): Cuid2Action> | undefined> { diff --git a/library/src/actions/decimal/decimal.ts b/library/src/actions/decimal/decimal.ts index 9de39b239..ac0a026d8 100644 --- a/library/src/actions/decimal/decimal.ts +++ b/library/src/actions/decimal/decimal.ts @@ -83,6 +83,7 @@ export function decimal< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): DecimalAction; +// @__NO_SIDE_EFFECTS__ export function decimal( message?: ErrorMessage> ): DecimalAction> | undefined> { diff --git a/library/src/actions/description/description.ts b/library/src/actions/description/description.ts index f3057953d..5d8dcf3d1 100644 --- a/library/src/actions/description/description.ts +++ b/library/src/actions/description/description.ts @@ -25,6 +25,8 @@ export interface DescriptionAction * @param description_ The description text. * * @returns A description action. + * + * @__NO_SIDE_EFFECTS__ */ export function description( description_: TDescription diff --git a/library/src/actions/digits/digits.ts b/library/src/actions/digits/digits.ts index 1824b11d4..d36db2a5b 100644 --- a/library/src/actions/digits/digits.ts +++ b/library/src/actions/digits/digits.ts @@ -83,6 +83,7 @@ export function digits< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): DigitsAction; +// @__NO_SIDE_EFFECTS__ export function digits( message?: ErrorMessage> ): DigitsAction> | undefined> { diff --git a/library/src/actions/email/email.ts b/library/src/actions/email/email.ts index 1f0513a02..eafa172e8 100644 --- a/library/src/actions/email/email.ts +++ b/library/src/actions/email/email.ts @@ -90,6 +90,7 @@ export function email< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): EmailAction; +// @__NO_SIDE_EFFECTS__ export function email( message?: ErrorMessage> ): EmailAction> | undefined> { diff --git a/library/src/actions/emoji/emoji.ts b/library/src/actions/emoji/emoji.ts index 32bf1707c..c2b346112 100644 --- a/library/src/actions/emoji/emoji.ts +++ b/library/src/actions/emoji/emoji.ts @@ -80,6 +80,7 @@ export function emoji< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): EmojiAction; +// @__NO_SIDE_EFFECTS__ export function emoji( message?: ErrorMessage> ): EmojiAction> | undefined> { diff --git a/library/src/actions/empty/empty.ts b/library/src/actions/empty/empty.ts index 9ef7d40ab..a7a11d397 100644 --- a/library/src/actions/empty/empty.ts +++ b/library/src/actions/empty/empty.ts @@ -76,6 +76,7 @@ export function empty< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): EmptyAction; +// @__NO_SIDE_EFFECTS__ export function empty( message?: ErrorMessage> ): EmptyAction> | undefined> { diff --git a/library/src/actions/endsWith/endsWith.ts b/library/src/actions/endsWith/endsWith.ts index 1a0dd7ed1..d521c0740 100644 --- a/library/src/actions/endsWith/endsWith.ts +++ b/library/src/actions/endsWith/endsWith.ts @@ -97,6 +97,7 @@ export function endsWith< message: TMessage ): EndsWithAction; +// @__NO_SIDE_EFFECTS__ export function endsWith( requirement: string, message?: ErrorMessage> diff --git a/library/src/actions/everyItem/everyItem.ts b/library/src/actions/everyItem/everyItem.ts index 2d9170f44..b8de87ee4 100644 --- a/library/src/actions/everyItem/everyItem.ts +++ b/library/src/actions/everyItem/everyItem.ts @@ -85,6 +85,7 @@ export function everyItem< message: TMessage ): EveryItemAction; +// @__NO_SIDE_EFFECTS__ export function everyItem( requirement: ArrayRequirement, message?: ErrorMessage> diff --git a/library/src/actions/excludes/excludes.ts b/library/src/actions/excludes/excludes.ts index 4f7dc4764..b37b1e79c 100644 --- a/library/src/actions/excludes/excludes.ts +++ b/library/src/actions/excludes/excludes.ts @@ -94,6 +94,7 @@ export function excludes< message: TMessage ): ExcludesAction; +// @__NO_SIDE_EFFECTS__ export function excludes( requirement: ContentRequirement, message?: ErrorMessage< diff --git a/library/src/actions/finite/finite.ts b/library/src/actions/finite/finite.ts index 22b62eed3..3ad31f87c 100644 --- a/library/src/actions/finite/finite.ts +++ b/library/src/actions/finite/finite.ts @@ -82,6 +82,7 @@ export function finite< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): FiniteAction; +// @__NO_SIDE_EFFECTS__ export function finite( message?: ErrorMessage> ): FiniteAction> | undefined> { diff --git a/library/src/actions/graphemes/graphemes.ts b/library/src/actions/graphemes/graphemes.ts index cea2b607b..a040cf4a4 100644 --- a/library/src/actions/graphemes/graphemes.ts +++ b/library/src/actions/graphemes/graphemes.ts @@ -97,6 +97,7 @@ export function graphemes< message: TMessage ): GraphemesAction; +// @__NO_SIDE_EFFECTS__ export function graphemes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/hash/hash.ts b/library/src/actions/hash/hash.ts index 44c6e91ad..8da2aeb5b 100644 --- a/library/src/actions/hash/hash.ts +++ b/library/src/actions/hash/hash.ts @@ -112,6 +112,7 @@ export function hash< message: TMessage ): HashAction; +// @__NO_SIDE_EFFECTS__ export function hash( types: [HashType, ...HashType[]], message?: ErrorMessage> diff --git a/library/src/actions/hexColor/hexColor.ts b/library/src/actions/hexColor/hexColor.ts index d405d4761..adc3de07c 100644 --- a/library/src/actions/hexColor/hexColor.ts +++ b/library/src/actions/hexColor/hexColor.ts @@ -84,6 +84,7 @@ export function hexColor< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): HexColorAction; +// @__NO_SIDE_EFFECTS__ export function hexColor( message?: ErrorMessage> ): HexColorAction> | undefined> { diff --git a/library/src/actions/hexadecimal/hexadecimal.ts b/library/src/actions/hexadecimal/hexadecimal.ts index 3e9f3ef5d..65bf708c9 100644 --- a/library/src/actions/hexadecimal/hexadecimal.ts +++ b/library/src/actions/hexadecimal/hexadecimal.ts @@ -84,6 +84,7 @@ export function hexadecimal< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): HexadecimalAction; +// @__NO_SIDE_EFFECTS__ export function hexadecimal( message?: ErrorMessage> ): HexadecimalAction< diff --git a/library/src/actions/imei/imei.ts b/library/src/actions/imei/imei.ts index 9330f24a7..6f9acb32b 100644 --- a/library/src/actions/imei/imei.ts +++ b/library/src/actions/imei/imei.ts @@ -88,6 +88,7 @@ export function imei< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): ImeiAction; +// @__NO_SIDE_EFFECTS__ export function imei( message?: ErrorMessage> ): ImeiAction> | undefined> { diff --git a/library/src/actions/includes/includes.ts b/library/src/actions/includes/includes.ts index 04652c8ed..a0c3ebdcf 100644 --- a/library/src/actions/includes/includes.ts +++ b/library/src/actions/includes/includes.ts @@ -94,6 +94,7 @@ export function includes< message: TMessage ): IncludesAction; +// @__NO_SIDE_EFFECTS__ export function includes( requirement: ContentRequirement, message?: ErrorMessage< diff --git a/library/src/actions/integer/integer.ts b/library/src/actions/integer/integer.ts index 085e27ce4..12b77a5be 100644 --- a/library/src/actions/integer/integer.ts +++ b/library/src/actions/integer/integer.ts @@ -82,6 +82,7 @@ export function integer< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IntegerAction; +// @__NO_SIDE_EFFECTS__ export function integer( message?: ErrorMessage> ): IntegerAction> | undefined> { diff --git a/library/src/actions/ip/ip.ts b/library/src/actions/ip/ip.ts index 82f523bc3..c3a2c7928 100644 --- a/library/src/actions/ip/ip.ts +++ b/library/src/actions/ip/ip.ts @@ -80,6 +80,7 @@ export function ip< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IpAction; +// @__NO_SIDE_EFFECTS__ export function ip( message?: ErrorMessage> ): IpAction> | undefined> { diff --git a/library/src/actions/ipv4/ipv4.ts b/library/src/actions/ipv4/ipv4.ts index 36cdedce7..dbcd2d02b 100644 --- a/library/src/actions/ipv4/ipv4.ts +++ b/library/src/actions/ipv4/ipv4.ts @@ -80,6 +80,7 @@ export function ipv4< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): Ipv4Action; +// @__NO_SIDE_EFFECTS__ export function ipv4( message?: ErrorMessage> ): Ipv4Action> | undefined> { diff --git a/library/src/actions/ipv6/ipv6.ts b/library/src/actions/ipv6/ipv6.ts index 61fe1ce42..600e5281f 100644 --- a/library/src/actions/ipv6/ipv6.ts +++ b/library/src/actions/ipv6/ipv6.ts @@ -80,6 +80,7 @@ export function ipv6< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): Ipv6Action; +// @__NO_SIDE_EFFECTS__ export function ipv6( message?: ErrorMessage> ): Ipv6Action> | undefined> { diff --git a/library/src/actions/isoDate/isoDate.ts b/library/src/actions/isoDate/isoDate.ts index b2a8ff446..2acc7b450 100644 --- a/library/src/actions/isoDate/isoDate.ts +++ b/library/src/actions/isoDate/isoDate.ts @@ -95,6 +95,7 @@ export function isoDate< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IsoDateAction; +// @__NO_SIDE_EFFECTS__ export function isoDate( message?: ErrorMessage> ): IsoDateAction> | undefined> { diff --git a/library/src/actions/isoDateTime/isoDateTime.ts b/library/src/actions/isoDateTime/isoDateTime.ts index df113d276..380f712ba 100644 --- a/library/src/actions/isoDateTime/isoDateTime.ts +++ b/library/src/actions/isoDateTime/isoDateTime.ts @@ -96,6 +96,7 @@ export function isoDateTime< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IsoDateTimeAction; +// @__NO_SIDE_EFFECTS__ export function isoDateTime( message?: ErrorMessage> ): IsoDateTimeAction< diff --git a/library/src/actions/isoTime/isoTime.ts b/library/src/actions/isoTime/isoTime.ts index bace84530..cba72c29f 100644 --- a/library/src/actions/isoTime/isoTime.ts +++ b/library/src/actions/isoTime/isoTime.ts @@ -87,6 +87,7 @@ export function isoTime< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IsoTimeAction; +// @__NO_SIDE_EFFECTS__ export function isoTime( message?: ErrorMessage> ): IsoTimeAction> | undefined> { diff --git a/library/src/actions/isoTimeSecond/isoTimeSecond.ts b/library/src/actions/isoTimeSecond/isoTimeSecond.ts index 30f00932e..e87b5c4fb 100644 --- a/library/src/actions/isoTimeSecond/isoTimeSecond.ts +++ b/library/src/actions/isoTimeSecond/isoTimeSecond.ts @@ -88,6 +88,7 @@ export function isoTimeSecond< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IsoTimeSecondAction; +// @__NO_SIDE_EFFECTS__ export function isoTimeSecond( message?: ErrorMessage> ): IsoTimeSecondAction< diff --git a/library/src/actions/isoTimestamp/isoTimestamp.ts b/library/src/actions/isoTimestamp/isoTimestamp.ts index e61b42a46..5598acf31 100644 --- a/library/src/actions/isoTimestamp/isoTimestamp.ts +++ b/library/src/actions/isoTimestamp/isoTimestamp.ts @@ -111,6 +111,7 @@ export function isoTimestamp< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IsoTimestampAction; +// @__NO_SIDE_EFFECTS__ export function isoTimestamp( message?: ErrorMessage> ): IsoTimestampAction< diff --git a/library/src/actions/isoWeek/isoWeek.ts b/library/src/actions/isoWeek/isoWeek.ts index b2d7c17fa..9accb1ea8 100644 --- a/library/src/actions/isoWeek/isoWeek.ts +++ b/library/src/actions/isoWeek/isoWeek.ts @@ -93,6 +93,7 @@ export function isoWeek< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): IsoWeekAction; +// @__NO_SIDE_EFFECTS__ export function isoWeek( message?: ErrorMessage> ): IsoWeekAction> | undefined> { diff --git a/library/src/actions/length/length.ts b/library/src/actions/length/length.ts index 3b5828a54..b4a841c52 100644 --- a/library/src/actions/length/length.ts +++ b/library/src/actions/length/length.ts @@ -96,6 +96,7 @@ export function length< message: TMessage ): LengthAction; +// @__NO_SIDE_EFFECTS__ export function length( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/mac/mac.ts b/library/src/actions/mac/mac.ts index adea8124f..c43fc5f87 100644 --- a/library/src/actions/mac/mac.ts +++ b/library/src/actions/mac/mac.ts @@ -80,6 +80,7 @@ export function mac< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): MacAction; +// @__NO_SIDE_EFFECTS__ export function mac( message?: ErrorMessage> ): MacAction> | undefined> { diff --git a/library/src/actions/mac48/mac48.ts b/library/src/actions/mac48/mac48.ts index 5c117f108..d321be9c0 100644 --- a/library/src/actions/mac48/mac48.ts +++ b/library/src/actions/mac48/mac48.ts @@ -80,6 +80,7 @@ export function mac48< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): Mac48Action; +// @__NO_SIDE_EFFECTS__ export function mac48( message?: ErrorMessage> ): Mac48Action> | undefined> { diff --git a/library/src/actions/mac64/mac64.ts b/library/src/actions/mac64/mac64.ts index d18a39cc1..be86aa1e8 100644 --- a/library/src/actions/mac64/mac64.ts +++ b/library/src/actions/mac64/mac64.ts @@ -80,6 +80,7 @@ export function mac64< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): Mac64Action; +// @__NO_SIDE_EFFECTS__ export function mac64( message?: ErrorMessage> ): Mac64Action> | undefined> { diff --git a/library/src/actions/mapItems/mapItems.ts b/library/src/actions/mapItems/mapItems.ts index 1a279f771..fccfab13b 100644 --- a/library/src/actions/mapItems/mapItems.ts +++ b/library/src/actions/mapItems/mapItems.ts @@ -40,6 +40,7 @@ export function mapItems( operation: ArrayAction ): MapItemsAction; +// @__NO_SIDE_EFFECTS__ export function mapItems( operation: ArrayAction ): MapItemsAction { diff --git a/library/src/actions/maxBytes/maxBytes.ts b/library/src/actions/maxBytes/maxBytes.ts index a678229a5..ddebf9aeb 100644 --- a/library/src/actions/maxBytes/maxBytes.ts +++ b/library/src/actions/maxBytes/maxBytes.ts @@ -97,6 +97,7 @@ export function maxBytes< message: TMessage ): MaxBytesAction; +// @__NO_SIDE_EFFECTS__ export function maxBytes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/maxGraphemes/maxGraphemes.ts b/library/src/actions/maxGraphemes/maxGraphemes.ts index b070512c1..2b6711e8c 100644 --- a/library/src/actions/maxGraphemes/maxGraphemes.ts +++ b/library/src/actions/maxGraphemes/maxGraphemes.ts @@ -103,6 +103,7 @@ export function maxGraphemes< message: TMessage ): MaxGraphemesAction; +// @__NO_SIDE_EFFECTS__ export function maxGraphemes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/maxLength/maxLength.ts b/library/src/actions/maxLength/maxLength.ts index 4fef49cfd..e7d1c2d43 100644 --- a/library/src/actions/maxLength/maxLength.ts +++ b/library/src/actions/maxLength/maxLength.ts @@ -98,6 +98,7 @@ export function maxLength< message: TMessage ): MaxLengthAction; +// @__NO_SIDE_EFFECTS__ export function maxLength( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/maxSize/maxSize.ts b/library/src/actions/maxSize/maxSize.ts index 9a82d8669..e3262e0e6 100644 --- a/library/src/actions/maxSize/maxSize.ts +++ b/library/src/actions/maxSize/maxSize.ts @@ -96,6 +96,7 @@ export function maxSize< message: TMessage ): MaxSizeAction; +// @__NO_SIDE_EFFECTS__ export function maxSize( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/maxValue/maxValue.ts b/library/src/actions/maxValue/maxValue.ts index bfc8564e1..cadf0def4 100644 --- a/library/src/actions/maxValue/maxValue.ts +++ b/library/src/actions/maxValue/maxValue.ts @@ -94,6 +94,7 @@ export function maxValue< message: TMessage ): MaxValueAction; +// @__NO_SIDE_EFFECTS__ export function maxValue( requirement: ValueInput, message?: ErrorMessage> diff --git a/library/src/actions/maxWords/maxWords.ts b/library/src/actions/maxWords/maxWords.ts index f75c4fa9b..1a8e702d0 100644 --- a/library/src/actions/maxWords/maxWords.ts +++ b/library/src/actions/maxWords/maxWords.ts @@ -110,6 +110,7 @@ export function maxWords< message: TMessage ): MaxWordsAction; +// @__NO_SIDE_EFFECTS__ export function maxWords( locales: Intl.LocalesArgument, requirement: number, diff --git a/library/src/actions/minBytes/minBytes.ts b/library/src/actions/minBytes/minBytes.ts index 80523fba5..713e81f63 100644 --- a/library/src/actions/minBytes/minBytes.ts +++ b/library/src/actions/minBytes/minBytes.ts @@ -97,6 +97,7 @@ export function minBytes< message: TMessage ): MinBytesAction; +// @__NO_SIDE_EFFECTS__ export function minBytes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/minLength/minLength.ts b/library/src/actions/minLength/minLength.ts index cf81cf93f..b4d774ced 100644 --- a/library/src/actions/minLength/minLength.ts +++ b/library/src/actions/minLength/minLength.ts @@ -98,6 +98,7 @@ export function minLength< message: TMessage ): MinLengthAction; +// @__NO_SIDE_EFFECTS__ export function minLength( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/minSize/minSize.ts b/library/src/actions/minSize/minSize.ts index a430982f7..40d321604 100644 --- a/library/src/actions/minSize/minSize.ts +++ b/library/src/actions/minSize/minSize.ts @@ -96,6 +96,7 @@ export function minSize< message: TMessage ): MinSizeAction; +// @__NO_SIDE_EFFECTS__ export function minSize( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/minWords/minWords.ts b/library/src/actions/minWords/minWords.ts index 19baedc6d..4297f3e8d 100644 --- a/library/src/actions/minWords/minWords.ts +++ b/library/src/actions/minWords/minWords.ts @@ -110,6 +110,7 @@ export function minWords< message: TMessage ): MinWordsAction; +// @__NO_SIDE_EFFECTS__ export function minWords( locales: Intl.LocalesArgument, requirement: number, diff --git a/library/src/actions/multipleOf/multipleOf.ts b/library/src/actions/multipleOf/multipleOf.ts index 1f34b4932..47ae95cec 100644 --- a/library/src/actions/multipleOf/multipleOf.ts +++ b/library/src/actions/multipleOf/multipleOf.ts @@ -101,6 +101,7 @@ export function multipleOf< message: TMessage ): MultipleOfAction; +// @__NO_SIDE_EFFECTS__ export function multipleOf( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/nanoid/nanoid.ts b/library/src/actions/nanoid/nanoid.ts index 85c16532f..6503b09b0 100644 --- a/library/src/actions/nanoid/nanoid.ts +++ b/library/src/actions/nanoid/nanoid.ts @@ -83,6 +83,7 @@ export function nanoid< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): NanoIDAction; +// @__NO_SIDE_EFFECTS__ export function nanoid( message?: ErrorMessage> ): NanoIDAction> | undefined> { diff --git a/library/src/actions/nonEmpty/nonEmpty.ts b/library/src/actions/nonEmpty/nonEmpty.ts index 634d2c372..5430602fe 100644 --- a/library/src/actions/nonEmpty/nonEmpty.ts +++ b/library/src/actions/nonEmpty/nonEmpty.ts @@ -76,6 +76,7 @@ export function nonEmpty< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): NonEmptyAction; +// @__NO_SIDE_EFFECTS__ export function nonEmpty( message?: ErrorMessage> ): NonEmptyAction< diff --git a/library/src/actions/normalize/normalize.ts b/library/src/actions/normalize/normalize.ts index a24ce89b4..d489aabde 100644 --- a/library/src/actions/normalize/normalize.ts +++ b/library/src/actions/normalize/normalize.ts @@ -42,6 +42,7 @@ export function normalize( form: TForm ): NormalizeAction; +// @__NO_SIDE_EFFECTS__ export function normalize( form?: NormalizeForm ): NormalizeAction { diff --git a/library/src/actions/notBytes/notBytes.ts b/library/src/actions/notBytes/notBytes.ts index de918fe50..ab728728d 100644 --- a/library/src/actions/notBytes/notBytes.ts +++ b/library/src/actions/notBytes/notBytes.ts @@ -97,6 +97,7 @@ export function notBytes< message: TMessage ): NotBytesAction; +// @__NO_SIDE_EFFECTS__ export function notBytes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/notGraphemes/notGraphemes.ts b/library/src/actions/notGraphemes/notGraphemes.ts index dccc37dd6..c145274c3 100644 --- a/library/src/actions/notGraphemes/notGraphemes.ts +++ b/library/src/actions/notGraphemes/notGraphemes.ts @@ -103,6 +103,7 @@ export function notGraphemes< message: TMessage ): NotGraphemesAction; +// @__NO_SIDE_EFFECTS__ export function notGraphemes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/notLength/notLength.ts b/library/src/actions/notLength/notLength.ts index 6ab0a9135..611c63bb9 100644 --- a/library/src/actions/notLength/notLength.ts +++ b/library/src/actions/notLength/notLength.ts @@ -98,6 +98,7 @@ export function notLength< message: TMessage ): NotLengthAction; +// @__NO_SIDE_EFFECTS__ export function notLength( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/notValue/notValue.ts b/library/src/actions/notValue/notValue.ts index 7d6fe96bf..771f91c35 100644 --- a/library/src/actions/notValue/notValue.ts +++ b/library/src/actions/notValue/notValue.ts @@ -94,6 +94,7 @@ export function notValue< message: TMessage ): NotValueAction; +// @__NO_SIDE_EFFECTS__ export function notValue( requirement: ValueInput, message?: ErrorMessage> diff --git a/library/src/actions/notWords/notWords.ts b/library/src/actions/notWords/notWords.ts index f4d0e8256..90333ebde 100644 --- a/library/src/actions/notWords/notWords.ts +++ b/library/src/actions/notWords/notWords.ts @@ -110,6 +110,7 @@ export function notWords< message: TMessage ): NotWordsAction; +// @__NO_SIDE_EFFECTS__ export function notWords( locales: Intl.LocalesArgument, requirement: number, diff --git a/library/src/actions/octal/octal.ts b/library/src/actions/octal/octal.ts index f963c14db..22535bba7 100644 --- a/library/src/actions/octal/octal.ts +++ b/library/src/actions/octal/octal.ts @@ -80,6 +80,7 @@ export function octal< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): OctalAction; +// @__NO_SIDE_EFFECTS__ export function octal( message?: ErrorMessage> ): OctalAction> | undefined> { diff --git a/library/src/actions/partialCheck/partialCheck.ts b/library/src/actions/partialCheck/partialCheck.ts index 788c37a10..114605243 100644 --- a/library/src/actions/partialCheck/partialCheck.ts +++ b/library/src/actions/partialCheck/partialCheck.ts @@ -82,6 +82,7 @@ export function partialCheck< message: TMessage ): PartialCheckAction; +// @__NO_SIDE_EFFECTS__ export function partialCheck( pathList: PathKeys[], requirement: (input: PartialInput) => boolean, diff --git a/library/src/actions/partialCheck/partialCheckAsync.ts b/library/src/actions/partialCheck/partialCheckAsync.ts index e2ccc82a8..edc90dfab 100644 --- a/library/src/actions/partialCheck/partialCheckAsync.ts +++ b/library/src/actions/partialCheck/partialCheckAsync.ts @@ -83,6 +83,7 @@ export function partialCheckAsync< message: TMessage ): PartialCheckActionAsync; +// @__NO_SIDE_EFFECTS__ export function partialCheckAsync( pathList: PathKeys[], requirement: (input: PartialInput) => MaybePromise, diff --git a/library/src/actions/rawCheck/rawCheck.ts b/library/src/actions/rawCheck/rawCheck.ts index bb518ce17..44c4d6c1e 100644 --- a/library/src/actions/rawCheck/rawCheck.ts +++ b/library/src/actions/rawCheck/rawCheck.ts @@ -27,6 +27,8 @@ export interface RawCheckAction * @param action The validation action. * * @returns A raw check action. + * + * @__NO_SIDE_EFFECTS__ */ export function rawCheck( action: (context: Context) => void diff --git a/library/src/actions/rawCheck/rawCheckAsync.ts b/library/src/actions/rawCheck/rawCheckAsync.ts index 223fd4a32..d7e6387e3 100644 --- a/library/src/actions/rawCheck/rawCheckAsync.ts +++ b/library/src/actions/rawCheck/rawCheckAsync.ts @@ -27,6 +27,8 @@ export interface RawCheckActionAsync * @param action The validation action. * * @returns A raw check action. + * + * @__NO_SIDE_EFFECTS__ */ export function rawCheckAsync( action: (context: Context) => MaybePromise diff --git a/library/src/actions/rawTransform/rawTransform.ts b/library/src/actions/rawTransform/rawTransform.ts index d3200cfc2..e80e4c05d 100644 --- a/library/src/actions/rawTransform/rawTransform.ts +++ b/library/src/actions/rawTransform/rawTransform.ts @@ -27,6 +27,8 @@ export interface RawTransformAction * @param action The transformation action. * * @returns A raw transform action. + * + * @__NO_SIDE_EFFECTS__ */ export function rawTransform( action: (context: Context) => TOutput diff --git a/library/src/actions/rawTransform/rawTransformAsync.ts b/library/src/actions/rawTransform/rawTransformAsync.ts index 377da4137..06a7847f4 100644 --- a/library/src/actions/rawTransform/rawTransformAsync.ts +++ b/library/src/actions/rawTransform/rawTransformAsync.ts @@ -28,6 +28,8 @@ export interface RawTransformActionAsync * @param action The transformation action. * * @returns A raw transform action. + * + * @__NO_SIDE_EFFECTS__ */ export function rawTransformAsync( action: (context: Context) => MaybePromise diff --git a/library/src/actions/readonly/readonly.ts b/library/src/actions/readonly/readonly.ts index 63ae15f43..08046558d 100644 --- a/library/src/actions/readonly/readonly.ts +++ b/library/src/actions/readonly/readonly.ts @@ -19,6 +19,8 @@ export interface ReadonlyAction * Creates a readonly transformation action. * * @returns A readonly action. + * + * @__NO_SIDE_EFFECTS__ */ export function readonly(): ReadonlyAction { return { diff --git a/library/src/actions/reduceItems/reduceItems.ts b/library/src/actions/reduceItems/reduceItems.ts index 1298d68ea..dd70728de 100644 --- a/library/src/actions/reduceItems/reduceItems.ts +++ b/library/src/actions/reduceItems/reduceItems.ts @@ -47,6 +47,7 @@ export function reduceItems( initial: TOutput ): ReduceItemsAction; +// @__NO_SIDE_EFFECTS__ export function reduceItems( operation: ArrayAction, initial: unknown diff --git a/library/src/actions/regex/regex.ts b/library/src/actions/regex/regex.ts index 23a60d765..f136a2118 100644 --- a/library/src/actions/regex/regex.ts +++ b/library/src/actions/regex/regex.ts @@ -84,6 +84,7 @@ export function regex< const TMessage extends ErrorMessage> | undefined, >(requirement: RegExp, message: TMessage): RegexAction; +// @__NO_SIDE_EFFECTS__ export function regex( requirement: RegExp, message?: ErrorMessage> diff --git a/library/src/actions/returns/returns.ts b/library/src/actions/returns/returns.ts index 789a828a7..b33a94054 100644 --- a/library/src/actions/returns/returns.ts +++ b/library/src/actions/returns/returns.ts @@ -49,6 +49,7 @@ export function returns< TSchema extends BaseSchema>, >(schema: TSchema): ReturnsAction; +// @__NO_SIDE_EFFECTS__ export function returns( schema: BaseSchema> ): ReturnsAction< diff --git a/library/src/actions/returns/returnsAsync.ts b/library/src/actions/returns/returnsAsync.ts index 6b42a647f..84511346c 100644 --- a/library/src/actions/returns/returnsAsync.ts +++ b/library/src/actions/returns/returnsAsync.ts @@ -55,6 +55,7 @@ export function returnsAsync< | BaseSchemaAsync>, >(schema: TSchema): ReturnsActionAsync; +// @__NO_SIDE_EFFECTS__ export function returnsAsync( schema: | BaseSchema> diff --git a/library/src/actions/safeInteger/safeInteger.ts b/library/src/actions/safeInteger/safeInteger.ts index b42eb1170..717f0d2f8 100644 --- a/library/src/actions/safeInteger/safeInteger.ts +++ b/library/src/actions/safeInteger/safeInteger.ts @@ -83,6 +83,7 @@ export function safeInteger< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): SafeIntegerAction; +// @__NO_SIDE_EFFECTS__ export function safeInteger( message?: ErrorMessage> ): SafeIntegerAction< diff --git a/library/src/actions/size/size.ts b/library/src/actions/size/size.ts index 77d98e080..f15d8a828 100644 --- a/library/src/actions/size/size.ts +++ b/library/src/actions/size/size.ts @@ -96,6 +96,7 @@ export function size< message: TMessage ): SizeAction; +// @__NO_SIDE_EFFECTS__ export function size( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/someItem/someItem.ts b/library/src/actions/someItem/someItem.ts index 1099213a6..6408cd331 100644 --- a/library/src/actions/someItem/someItem.ts +++ b/library/src/actions/someItem/someItem.ts @@ -85,6 +85,7 @@ export function someItem< message: TMessage ): SomeItemAction; +// @__NO_SIDE_EFFECTS__ export function someItem( requirement: ArrayRequirement, message?: ErrorMessage> diff --git a/library/src/actions/sortItems/sortItems.ts b/library/src/actions/sortItems/sortItems.ts index c31af291f..e6e4516ec 100644 --- a/library/src/actions/sortItems/sortItems.ts +++ b/library/src/actions/sortItems/sortItems.ts @@ -39,6 +39,7 @@ export function sortItems( operation?: ArrayAction ): SortItemsAction; +// @__NO_SIDE_EFFECTS__ export function sortItems( operation?: ArrayAction ): SortItemsAction { diff --git a/library/src/actions/startsWith/startsWith.ts b/library/src/actions/startsWith/startsWith.ts index c16990394..3f5fe7d04 100644 --- a/library/src/actions/startsWith/startsWith.ts +++ b/library/src/actions/startsWith/startsWith.ts @@ -101,6 +101,7 @@ export function startsWith< message: TMessage ): StartsWithAction; +// @__NO_SIDE_EFFECTS__ export function startsWith( requirement: string, message?: ErrorMessage> diff --git a/library/src/actions/title/title.ts b/library/src/actions/title/title.ts index 11fded485..5a677e3f6 100644 --- a/library/src/actions/title/title.ts +++ b/library/src/actions/title/title.ts @@ -25,6 +25,8 @@ export interface TitleAction * @param title_ The title text. * * @returns A title action. + * + * @__NO_SIDE_EFFECTS__ */ export function title( title_: TTitle diff --git a/library/src/actions/toLowerCase/toLowerCase.ts b/library/src/actions/toLowerCase/toLowerCase.ts index 5390efe95..d081c33f2 100644 --- a/library/src/actions/toLowerCase/toLowerCase.ts +++ b/library/src/actions/toLowerCase/toLowerCase.ts @@ -19,6 +19,8 @@ export interface ToLowerCaseAction * Creates a to lower case transformation action. * * @returns A to lower case action. + * + * @__NO_SIDE_EFFECTS__ */ export function toLowerCase(): ToLowerCaseAction { return { diff --git a/library/src/actions/toMaxValue/toMaxValue.ts b/library/src/actions/toMaxValue/toMaxValue.ts index 39123ffa0..4da97f00a 100644 --- a/library/src/actions/toMaxValue/toMaxValue.ts +++ b/library/src/actions/toMaxValue/toMaxValue.ts @@ -28,6 +28,8 @@ export interface ToMaxValueAction< * @param requirement The maximum value. * * @returns A to max value action. + * + * @__NO_SIDE_EFFECTS__ */ export function toMaxValue< TInput extends ValueInput, diff --git a/library/src/actions/toMinValue/toMinValue.ts b/library/src/actions/toMinValue/toMinValue.ts index 3bdd34b37..b5342e819 100644 --- a/library/src/actions/toMinValue/toMinValue.ts +++ b/library/src/actions/toMinValue/toMinValue.ts @@ -28,6 +28,8 @@ export interface ToMinValueAction< * @param requirement The minimum value. * * @returns A to min value action. + * + * @__NO_SIDE_EFFECTS__ */ export function toMinValue< TInput extends ValueInput, diff --git a/library/src/actions/toUpperCase/toUpperCase.ts b/library/src/actions/toUpperCase/toUpperCase.ts index 07d3e5dec..e0e829bc5 100644 --- a/library/src/actions/toUpperCase/toUpperCase.ts +++ b/library/src/actions/toUpperCase/toUpperCase.ts @@ -19,6 +19,8 @@ export interface ToUpperCaseAction * Creates a to upper case transformation action. * * @returns A to upper case action. + * + * @__NO_SIDE_EFFECTS__ */ export function toUpperCase(): ToUpperCaseAction { return { diff --git a/library/src/actions/transform/transform.ts b/library/src/actions/transform/transform.ts index ffca651c7..0697a820d 100644 --- a/library/src/actions/transform/transform.ts +++ b/library/src/actions/transform/transform.ts @@ -25,6 +25,8 @@ export interface TransformAction * @param operation The transformation operation. * * @returns A transform action. + * + * @__NO_SIDE_EFFECTS__ */ export function transform( operation: (input: TInput) => TOutput diff --git a/library/src/actions/transform/transformAsync.ts b/library/src/actions/transform/transformAsync.ts index a9e897d4e..6824c86fb 100644 --- a/library/src/actions/transform/transformAsync.ts +++ b/library/src/actions/transform/transformAsync.ts @@ -28,6 +28,8 @@ export interface TransformActionAsync * @param operation The transformation operation. * * @returns A transform action. + * + * @__NO_SIDE_EFFECTS__ */ export function transformAsync( operation: (input: TInput) => Promise diff --git a/library/src/actions/trim/trim.ts b/library/src/actions/trim/trim.ts index c9820dbc1..826f26021 100644 --- a/library/src/actions/trim/trim.ts +++ b/library/src/actions/trim/trim.ts @@ -18,6 +18,8 @@ export interface TrimAction extends BaseTransformation { * Creates a trim transformation action. * * @returns A trim action. + * + * @__NO_SIDE_EFFECTS__ */ export function trim(): TrimAction { return { diff --git a/library/src/actions/trimEnd/trimEnd.ts b/library/src/actions/trimEnd/trimEnd.ts index 16b32dfc7..e8d68a6ad 100644 --- a/library/src/actions/trimEnd/trimEnd.ts +++ b/library/src/actions/trimEnd/trimEnd.ts @@ -19,6 +19,8 @@ export interface TrimEndAction * Creates a trim end transformation action. * * @returns A trim end action. + * + * @__NO_SIDE_EFFECTS__ */ export function trimEnd(): TrimEndAction { return { diff --git a/library/src/actions/ulid/ulid.ts b/library/src/actions/ulid/ulid.ts index 4cda0e677..5ee41a6c6 100644 --- a/library/src/actions/ulid/ulid.ts +++ b/library/src/actions/ulid/ulid.ts @@ -80,6 +80,7 @@ export function ulid< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): UlidAction; +// @__NO_SIDE_EFFECTS__ export function ulid( message?: ErrorMessage> ): UlidAction> | undefined> { diff --git a/library/src/actions/url/url.ts b/library/src/actions/url/url.ts index 6c70032ce..efcf90102 100644 --- a/library/src/actions/url/url.ts +++ b/library/src/actions/url/url.ts @@ -85,6 +85,7 @@ export function url< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): UrlAction; +// @__NO_SIDE_EFFECTS__ export function url( message?: ErrorMessage> | undefined ): UrlAction> | undefined> { diff --git a/library/src/actions/uuid/uuid.ts b/library/src/actions/uuid/uuid.ts index c8f30f24d..75b85714e 100644 --- a/library/src/actions/uuid/uuid.ts +++ b/library/src/actions/uuid/uuid.ts @@ -80,6 +80,7 @@ export function uuid< const TMessage extends ErrorMessage> | undefined, >(message: TMessage): UuidAction; +// @__NO_SIDE_EFFECTS__ export function uuid( message?: ErrorMessage> ): UuidAction> | undefined> { diff --git a/library/src/actions/value/value.ts b/library/src/actions/value/value.ts index d138fd767..00d5e1b27 100644 --- a/library/src/actions/value/value.ts +++ b/library/src/actions/value/value.ts @@ -92,6 +92,7 @@ export function value< message: TMessage ): ValueAction; +// @__NO_SIDE_EFFECTS__ export function value( requirement: ValueInput, message?: ErrorMessage> diff --git a/library/src/actions/words/words.ts b/library/src/actions/words/words.ts index f14db5ede..0fb71a781 100644 --- a/library/src/actions/words/words.ts +++ b/library/src/actions/words/words.ts @@ -106,6 +106,7 @@ export function words< message: TMessage ): WordsAction; +// @__NO_SIDE_EFFECTS__ export function words( locales: Intl.LocalesArgument, requirement: number, diff --git a/library/src/methods/assert/assert.ts b/library/src/methods/assert/assert.ts index b1f5f975f..3af1aec16 100644 --- a/library/src/methods/assert/assert.ts +++ b/library/src/methods/assert/assert.ts @@ -7,6 +7,8 @@ import { ValiError } from '../../utils/index.ts'; * * @param schema The schema to be used. * @param input The input to be tested. + * + * @__NO_SIDE_EFFECTS__ */ export function assert< const TSchema extends BaseSchema>, diff --git a/library/src/methods/config/config.ts b/library/src/methods/config/config.ts index 2ac2222e5..a0d4fa120 100644 --- a/library/src/methods/config/config.ts +++ b/library/src/methods/config/config.ts @@ -14,6 +14,8 @@ import { _getStandardProps } from '../../utils/index.ts'; * @param config The parse configuration. * * @returns The configured schema. + * + * @__NO_SIDE_EFFECTS__ */ export function config< const TSchema extends diff --git a/library/src/methods/fallback/fallback.ts b/library/src/methods/fallback/fallback.ts index 0c3f93def..0a62401f9 100644 --- a/library/src/methods/fallback/fallback.ts +++ b/library/src/methods/fallback/fallback.ts @@ -41,6 +41,8 @@ export type SchemaWithFallback< * @param fallback The fallback value. * * @returns The passed schema. + * + * @__NO_SIDE_EFFECTS__ */ export function fallback< const TSchema extends BaseSchema>, diff --git a/library/src/methods/fallback/fallbackAsync.ts b/library/src/methods/fallback/fallbackAsync.ts index 3b3a9b26f..0c8a47f4a 100644 --- a/library/src/methods/fallback/fallbackAsync.ts +++ b/library/src/methods/fallback/fallbackAsync.ts @@ -77,6 +77,8 @@ export type SchemaWithFallbackAsync< * @param fallback The fallback value. * * @returns The passed schema. + * + * @__NO_SIDE_EFFECTS__ */ export function fallbackAsync< const TSchema extends diff --git a/library/src/methods/flatten/flatten.ts b/library/src/methods/flatten/flatten.ts index 64a6cc028..891753145 100644 --- a/library/src/methods/flatten/flatten.ts +++ b/library/src/methods/flatten/flatten.ts @@ -79,6 +79,7 @@ export function flatten< | BaseSchemaAsync>, >(issues: [InferIssue, ...InferIssue[]]): FlatErrors; +// @__NO_SIDE_EFFECTS__ export function flatten( issues: [BaseIssue, ...BaseIssue[]] ): FlatErrors { diff --git a/library/src/methods/forward/forward.ts b/library/src/methods/forward/forward.ts index bd8323311..8dd3cea9f 100644 --- a/library/src/methods/forward/forward.ts +++ b/library/src/methods/forward/forward.ts @@ -19,6 +19,8 @@ import type { * @param pathKeys The path keys. * * @returns The modified action. + * + * @__NO_SIDE_EFFECTS__ */ export function forward< TInput extends Record | ArrayLike, diff --git a/library/src/methods/forward/forwardAsync.ts b/library/src/methods/forward/forwardAsync.ts index 1ff06197d..9c4e74f20 100644 --- a/library/src/methods/forward/forwardAsync.ts +++ b/library/src/methods/forward/forwardAsync.ts @@ -20,6 +20,8 @@ import type { * @param pathKeys The path keys. * * @returns The modified action. + * + * @__NO_SIDE_EFFECTS__ */ export function forwardAsync< TInput extends Record | ArrayLike, diff --git a/library/src/methods/getDefault/getDefault.ts b/library/src/methods/getDefault/getDefault.ts index 0f000ef9d..e9c6e2f9b 100644 --- a/library/src/methods/getDefault/getDefault.ts +++ b/library/src/methods/getDefault/getDefault.ts @@ -105,6 +105,8 @@ export type InferDefault< * @param config The config if available. * * @returns The default value. + * + * @__NO_SIDE_EFFECTS__ */ export function getDefault< const TSchema extends diff --git a/library/src/methods/getDefaults/getDefaults.ts b/library/src/methods/getDefaults/getDefaults.ts index d99545845..cb69f8181 100644 --- a/library/src/methods/getDefaults/getDefaults.ts +++ b/library/src/methods/getDefaults/getDefaults.ts @@ -36,6 +36,8 @@ import type { InferDefaults } from './types.ts'; * @param schema The schema to get them from. * * @returns The default values. + * + * @__NO_SIDE_EFFECTS__ */ export function getDefaults< const TSchema extends diff --git a/library/src/methods/getFallbacks/getFallbacks.ts b/library/src/methods/getFallbacks/getFallbacks.ts index ef685108b..780ff3498 100644 --- a/library/src/methods/getFallbacks/getFallbacks.ts +++ b/library/src/methods/getFallbacks/getFallbacks.ts @@ -36,6 +36,8 @@ import type { InferFallbacks } from './types.ts'; * @param schema The schema to get them from. * * @returns The fallback values. + * + * @__NO_SIDE_EFFECTS__ */ export function getFallbacks< const TSchema extends diff --git a/library/src/methods/is/is.ts b/library/src/methods/is/is.ts index 4d499dcb4..7593b7512 100644 --- a/library/src/methods/is/is.ts +++ b/library/src/methods/is/is.ts @@ -8,6 +8,8 @@ import type { BaseIssue, BaseSchema, InferInput } from '../../types/index.ts'; * @param input The input to be tested. * * @returns Whether the input matches the schema. + * + * @__NO_SIDE_EFFECTS__ */ export function is< const TSchema extends BaseSchema>, diff --git a/library/src/methods/keyof/keyof.ts b/library/src/methods/keyof/keyof.ts index 42bac0906..50a19e9bb 100644 --- a/library/src/methods/keyof/keyof.ts +++ b/library/src/methods/keyof/keyof.ts @@ -93,6 +93,7 @@ export function keyof< message: TMessage ): PicklistSchema, TMessage>; +// @__NO_SIDE_EFFECTS__ export function keyof( schema: Schema, message?: ErrorMessage diff --git a/library/src/methods/omit/omit.ts b/library/src/methods/omit/omit.ts index faea012b3..6f661f2ae 100644 --- a/library/src/methods/omit/omit.ts +++ b/library/src/methods/omit/omit.ts @@ -462,6 +462,8 @@ export type SchemaWithOmit< * @param keys The selected entries. * * @returns An object schema. + * + * @__NO_SIDE_EFFECTS__ */ export function omit< const TSchema extends Schema, diff --git a/library/src/methods/parse/parse.ts b/library/src/methods/parse/parse.ts index 17e488640..4f9e53ad9 100644 --- a/library/src/methods/parse/parse.ts +++ b/library/src/methods/parse/parse.ts @@ -16,6 +16,8 @@ import { ValiError } from '../../utils/index.ts'; * @param config The parse configuration. * * @returns The parsed input. + * + * @__NO_SIDE_EFFECTS__ */ export function parse< const TSchema extends BaseSchema>, diff --git a/library/src/methods/parser/parser.ts b/library/src/methods/parser/parser.ts index 9ba53bcf3..7dcb672b7 100644 --- a/library/src/methods/parser/parser.ts +++ b/library/src/methods/parser/parser.ts @@ -52,6 +52,7 @@ export function parser< const TConfig extends Config> | undefined, >(schema: TSchema, config: TConfig): Parser; +// @__NO_SIDE_EFFECTS__ export function parser( schema: BaseSchema>, config?: Config>>> diff --git a/library/src/methods/parser/parserAsync.ts b/library/src/methods/parser/parserAsync.ts index d316c7e56..2b97d843a 100644 --- a/library/src/methods/parser/parserAsync.ts +++ b/library/src/methods/parser/parserAsync.ts @@ -59,6 +59,7 @@ export function parserAsync< const TConfig extends Config> | undefined, >(schema: TSchema, config: TConfig): ParserAsync; +// @__NO_SIDE_EFFECTS__ export function parserAsync( schema: | BaseSchema> diff --git a/library/src/methods/partial/partial.ts b/library/src/methods/partial/partial.ts index 6a85cd5b8..218f392b0 100644 --- a/library/src/methods/partial/partial.ts +++ b/library/src/methods/partial/partial.ts @@ -266,6 +266,7 @@ export function partial< const TKeys extends ObjectKeys, >(schema: TSchema, keys: TKeys): SchemaWithPartial; +// @__NO_SIDE_EFFECTS__ export function partial( schema: Schema, keys?: ObjectKeys diff --git a/library/src/methods/partial/partialAsync.ts b/library/src/methods/partial/partialAsync.ts index e0e9d30be..da2620488 100644 --- a/library/src/methods/partial/partialAsync.ts +++ b/library/src/methods/partial/partialAsync.ts @@ -277,6 +277,7 @@ export function partialAsync< const TKeys extends ObjectKeys, >(schema: TSchema, keys: TKeys): SchemaWithPartialAsync; +// @__NO_SIDE_EFFECTS__ export function partialAsync( schema: Schema, keys?: ObjectKeys diff --git a/library/src/methods/pick/pick.ts b/library/src/methods/pick/pick.ts index 2a247448e..ae06744d7 100644 --- a/library/src/methods/pick/pick.ts +++ b/library/src/methods/pick/pick.ts @@ -462,6 +462,8 @@ export type SchemaWithPick< * @param keys The selected entries. * * @returns An object schema. + * + * @__NO_SIDE_EFFECTS__ */ export function pick< const TSchema extends Schema, diff --git a/library/src/methods/pipe/pipe.ts b/library/src/methods/pipe/pipe.ts index ab17c1bed..f30136db0 100644 --- a/library/src/methods/pipe/pipe.ts +++ b/library/src/methods/pipe/pipe.ts @@ -2666,6 +2666,7 @@ export function pipe< >[], >(schema: TSchema, ...items: TItems): SchemaWithPipe<[TSchema, ...TItems]>; +// @__NO_SIDE_EFFECTS__ export function pipe< const TSchema extends BaseSchema>, const TItems extends PipeItem>[], diff --git a/library/src/methods/pipe/pipeAsync.ts b/library/src/methods/pipe/pipeAsync.ts index d062742de..39fd3c8ca 100644 --- a/library/src/methods/pipe/pipeAsync.ts +++ b/library/src/methods/pipe/pipeAsync.ts @@ -3051,6 +3051,7 @@ export function pipeAsync< )[], >(schema: TSchema, ...items: TItems): SchemaWithPipeAsync<[TSchema, ...TItems]>; +// @__NO_SIDE_EFFECTS__ export function pipeAsync< const TSchema extends | BaseSchema> diff --git a/library/src/methods/required/required.ts b/library/src/methods/required/required.ts index 59a9a0678..e382dbbed 100644 --- a/library/src/methods/required/required.ts +++ b/library/src/methods/required/required.ts @@ -311,6 +311,7 @@ export function required< message: TMessage ): SchemaWithRequired; +// @__NO_SIDE_EFFECTS__ export function required( schema: Schema, arg2?: ErrorMessage | ObjectKeys, diff --git a/library/src/methods/required/requiredAsync.ts b/library/src/methods/required/requiredAsync.ts index 3dac720f1..8748e6922 100644 --- a/library/src/methods/required/requiredAsync.ts +++ b/library/src/methods/required/requiredAsync.ts @@ -325,6 +325,7 @@ export function requiredAsync< message: TMessage ): SchemaWithRequiredAsync; +// @__NO_SIDE_EFFECTS__ export function requiredAsync( schema: Schema, arg2?: ErrorMessage | ObjectKeys, diff --git a/library/src/methods/safeParse/safeParse.ts b/library/src/methods/safeParse/safeParse.ts index 8fbf3273b..73d0a5cf5 100644 --- a/library/src/methods/safeParse/safeParse.ts +++ b/library/src/methods/safeParse/safeParse.ts @@ -15,6 +15,8 @@ import type { SafeParseResult } from './types.ts'; * @param config The parse configuration. * * @returns The parse result. + * + * @__NO_SIDE_EFFECTS__ */ export function safeParse< const TSchema extends BaseSchema>, diff --git a/library/src/methods/safeParser/safeParser.ts b/library/src/methods/safeParser/safeParser.ts index b956520fe..447eaa1f7 100644 --- a/library/src/methods/safeParser/safeParser.ts +++ b/library/src/methods/safeParser/safeParser.ts @@ -51,6 +51,7 @@ export function safeParser< const TConfig extends Config> | undefined, >(schema: TSchema, config: TConfig): SafeParser; +// @__NO_SIDE_EFFECTS__ export function safeParser( schema: BaseSchema>, config?: Config>>> diff --git a/library/src/methods/safeParser/safeParserAsync.ts b/library/src/methods/safeParser/safeParserAsync.ts index 98c38c5b2..002b09bf8 100644 --- a/library/src/methods/safeParser/safeParserAsync.ts +++ b/library/src/methods/safeParser/safeParserAsync.ts @@ -58,6 +58,7 @@ export function safeParserAsync< const TConfig extends Config> | undefined, >(schema: TSchema, config: TConfig): SafeParserAsync; +// @__NO_SIDE_EFFECTS__ export function safeParserAsync( schema: | BaseSchema> diff --git a/library/src/methods/unwrap/unwrap.ts b/library/src/methods/unwrap/unwrap.ts index 53bbb03cb..55180b6ec 100644 --- a/library/src/methods/unwrap/unwrap.ts +++ b/library/src/methods/unwrap/unwrap.ts @@ -30,6 +30,8 @@ import type { * @param schema The schema to be unwrapped. * * @returns The unwrapped schema. + * + * @__NO_SIDE_EFFECTS__ */ export function unwrap< TSchema extends diff --git a/library/src/schemas/any/any.ts b/library/src/schemas/any/any.ts index 276a8f892..a3b76ccea 100644 --- a/library/src/schemas/any/any.ts +++ b/library/src/schemas/any/any.ts @@ -28,6 +28,8 @@ export interface AnySchema extends BaseSchema { * unknown data. * * @returns An any schema. + * + * @__NO_SIDE_EFFECTS__ */ export function any(): AnySchema { return { diff --git a/library/src/schemas/array/array.ts b/library/src/schemas/array/array.ts index 28ae95300..fed67a310 100644 --- a/library/src/schemas/array/array.ts +++ b/library/src/schemas/array/array.ts @@ -68,6 +68,7 @@ export function array< const TMessage extends ErrorMessage | undefined, >(item: TItem, message: TMessage): ArraySchema; +// @__NO_SIDE_EFFECTS__ export function array( item: BaseSchema>, message?: ErrorMessage diff --git a/library/src/schemas/array/arrayAsync.ts b/library/src/schemas/array/arrayAsync.ts index 8ee86a08b..0a0f57efe 100644 --- a/library/src/schemas/array/arrayAsync.ts +++ b/library/src/schemas/array/arrayAsync.ts @@ -75,6 +75,7 @@ export function arrayAsync< const TMessage extends ErrorMessage | undefined, >(item: TItem, message: TMessage): ArraySchemaAsync; +// @__NO_SIDE_EFFECTS__ export function arrayAsync( item: | BaseSchema> diff --git a/library/src/schemas/bigint/bigint.ts b/library/src/schemas/bigint/bigint.ts index da165d3cd..dca8356bb 100644 --- a/library/src/schemas/bigint/bigint.ts +++ b/library/src/schemas/bigint/bigint.ts @@ -66,6 +66,7 @@ export function bigint< const TMessage extends ErrorMessage | undefined, >(message: TMessage): BigintSchema; +// @__NO_SIDE_EFFECTS__ export function bigint( message?: ErrorMessage ): BigintSchema | undefined> { diff --git a/library/src/schemas/blob/blob.ts b/library/src/schemas/blob/blob.ts index 2832e61a4..d812887af 100644 --- a/library/src/schemas/blob/blob.ts +++ b/library/src/schemas/blob/blob.ts @@ -66,6 +66,7 @@ export function blob< const TMessage extends ErrorMessage | undefined, >(message: TMessage): BlobSchema; +// @__NO_SIDE_EFFECTS__ export function blob( message?: ErrorMessage ): BlobSchema | undefined> { diff --git a/library/src/schemas/boolean/boolean.ts b/library/src/schemas/boolean/boolean.ts index 1324686f4..07f5bbeff 100644 --- a/library/src/schemas/boolean/boolean.ts +++ b/library/src/schemas/boolean/boolean.ts @@ -66,6 +66,7 @@ export function boolean< const TMessage extends ErrorMessage | undefined, >(message: TMessage): BooleanSchema; +// @__NO_SIDE_EFFECTS__ export function boolean( message?: ErrorMessage ): BooleanSchema | undefined> { diff --git a/library/src/schemas/custom/custom.ts b/library/src/schemas/custom/custom.ts index babe90f25..e5fb6ad46 100644 --- a/library/src/schemas/custom/custom.ts +++ b/library/src/schemas/custom/custom.ts @@ -64,6 +64,7 @@ export function custom< | undefined, >(check: Check, message: TMessage): CustomSchema; +// @__NO_SIDE_EFFECTS__ export function custom( check: Check, message?: ErrorMessage diff --git a/library/src/schemas/custom/customAsync.ts b/library/src/schemas/custom/customAsync.ts index 48ce8cfa9..4b8a3250c 100644 --- a/library/src/schemas/custom/customAsync.ts +++ b/library/src/schemas/custom/customAsync.ts @@ -67,6 +67,7 @@ export function customAsync< | undefined, >(check: CheckAsync, message: TMessage): CustomSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function customAsync( check: CheckAsync, message?: ErrorMessage diff --git a/library/src/schemas/date/date.ts b/library/src/schemas/date/date.ts index e6da2e09d..45ecbfb0e 100644 --- a/library/src/schemas/date/date.ts +++ b/library/src/schemas/date/date.ts @@ -66,6 +66,7 @@ export function date< const TMessage extends ErrorMessage | undefined, >(message: TMessage): DateSchema; +// @__NO_SIDE_EFFECTS__ export function date( message?: ErrorMessage ): DateSchema | undefined> { diff --git a/library/src/schemas/enum/enum.ts b/library/src/schemas/enum/enum.ts index 362a445b7..a408630ba 100644 --- a/library/src/schemas/enum/enum.ts +++ b/library/src/schemas/enum/enum.ts @@ -89,6 +89,7 @@ export function enum_< const TMessage extends ErrorMessage | undefined, >(enum__: TEnum, message: TMessage): EnumSchema; +// @__NO_SIDE_EFFECTS__ export function enum_( enum__: Enum, message?: ErrorMessage diff --git a/library/src/schemas/file/file.ts b/library/src/schemas/file/file.ts index d5fdfc322..785815d70 100644 --- a/library/src/schemas/file/file.ts +++ b/library/src/schemas/file/file.ts @@ -66,6 +66,7 @@ export function file< const TMessage extends ErrorMessage | undefined, >(message: TMessage): FileSchema; +// @__NO_SIDE_EFFECTS__ export function file( message?: ErrorMessage ): FileSchema | undefined> { diff --git a/library/src/schemas/function/function.ts b/library/src/schemas/function/function.ts index 72ed5e956..ac47b7832 100644 --- a/library/src/schemas/function/function.ts +++ b/library/src/schemas/function/function.ts @@ -70,6 +70,7 @@ export function function_< const TMessage extends ErrorMessage | undefined, >(message: TMessage): FunctionSchema; +// @__NO_SIDE_EFFECTS__ export function function_( message?: ErrorMessage ): FunctionSchema | undefined> { diff --git a/library/src/schemas/instance/instance.ts b/library/src/schemas/instance/instance.ts index 76daa4573..76c386b3a 100644 --- a/library/src/schemas/instance/instance.ts +++ b/library/src/schemas/instance/instance.ts @@ -83,6 +83,7 @@ export function instance< const TMessage extends ErrorMessage | undefined, >(class_: TClass, message: TMessage): InstanceSchema; +// @__NO_SIDE_EFFECTS__ export function instance( class_: Class, message?: ErrorMessage diff --git a/library/src/schemas/intersect/intersect.ts b/library/src/schemas/intersect/intersect.ts index 42dab5a64..220c3232b 100644 --- a/library/src/schemas/intersect/intersect.ts +++ b/library/src/schemas/intersect/intersect.ts @@ -71,6 +71,7 @@ export function intersect< const TMessage extends ErrorMessage | undefined, >(options: TOptions, message: TMessage): IntersectSchema; +// @__NO_SIDE_EFFECTS__ export function intersect( options: IntersectOptions, message?: ErrorMessage diff --git a/library/src/schemas/intersect/intersectAsync.ts b/library/src/schemas/intersect/intersectAsync.ts index f9e6eb0bb..b6c52dbc2 100644 --- a/library/src/schemas/intersect/intersectAsync.ts +++ b/library/src/schemas/intersect/intersectAsync.ts @@ -74,6 +74,7 @@ export function intersectAsync< message: TMessage ): IntersectSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function intersectAsync( options: IntersectOptionsAsync, message?: ErrorMessage diff --git a/library/src/schemas/lazy/lazy.ts b/library/src/schemas/lazy/lazy.ts index ed758ecb7..288c86980 100644 --- a/library/src/schemas/lazy/lazy.ts +++ b/library/src/schemas/lazy/lazy.ts @@ -41,6 +41,8 @@ export interface LazySchema< * @param getter The schema getter. * * @returns A lazy schema. + * + * @__NO_SIDE_EFFECTS__ */ export function lazy< const TWrapped extends BaseSchema>, diff --git a/library/src/schemas/lazy/lazyAsync.ts b/library/src/schemas/lazy/lazyAsync.ts index a7e886b8d..c9ddc8643 100644 --- a/library/src/schemas/lazy/lazyAsync.ts +++ b/library/src/schemas/lazy/lazyAsync.ts @@ -45,6 +45,8 @@ export interface LazySchemaAsync< * @param getter The schema getter. * * @returns A lazy schema. + * + * @__NO_SIDE_EFFECTS__ */ export function lazyAsync< const TWrapped extends diff --git a/library/src/schemas/literal/literal.ts b/library/src/schemas/literal/literal.ts index b5bafccc4..75f1f9253 100644 --- a/library/src/schemas/literal/literal.ts +++ b/library/src/schemas/literal/literal.ts @@ -78,6 +78,7 @@ export function literal< const TMessage extends ErrorMessage | undefined, >(literal_: TLiteral, message: TMessage): LiteralSchema; +// @__NO_SIDE_EFFECTS__ export function literal( literal_: Literal, message?: ErrorMessage diff --git a/library/src/schemas/looseObject/looseObject.ts b/library/src/schemas/looseObject/looseObject.ts index 109845d5a..7f7ede05d 100644 --- a/library/src/schemas/looseObject/looseObject.ts +++ b/library/src/schemas/looseObject/looseObject.ts @@ -72,6 +72,7 @@ export function looseObject< const TMessage extends ErrorMessage | undefined, >(entries: TEntries, message: TMessage): LooseObjectSchema; +// @__NO_SIDE_EFFECTS__ export function looseObject( entries: ObjectEntries, message?: ErrorMessage diff --git a/library/src/schemas/looseObject/looseObjectAsync.ts b/library/src/schemas/looseObject/looseObjectAsync.ts index f55f9a61c..4720fa96d 100644 --- a/library/src/schemas/looseObject/looseObjectAsync.ts +++ b/library/src/schemas/looseObject/looseObjectAsync.ts @@ -75,6 +75,7 @@ export function looseObjectAsync< message: TMessage ): LooseObjectSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function looseObjectAsync( entries: ObjectEntriesAsync, message?: ErrorMessage diff --git a/library/src/schemas/looseTuple/looseTuple.ts b/library/src/schemas/looseTuple/looseTuple.ts index 2c58be715..bbef1d341 100644 --- a/library/src/schemas/looseTuple/looseTuple.ts +++ b/library/src/schemas/looseTuple/looseTuple.ts @@ -69,6 +69,7 @@ export function looseTuple< const TMessage extends ErrorMessage | undefined, >(items: TItems, message: TMessage): LooseTupleSchema; +// @__NO_SIDE_EFFECTS__ export function looseTuple( items: TupleItems, message?: ErrorMessage diff --git a/library/src/schemas/looseTuple/looseTupleAsync.ts b/library/src/schemas/looseTuple/looseTupleAsync.ts index 36abfc5d4..f96f39b02 100644 --- a/library/src/schemas/looseTuple/looseTupleAsync.ts +++ b/library/src/schemas/looseTuple/looseTupleAsync.ts @@ -69,6 +69,7 @@ export function looseTupleAsync< const TMessage extends ErrorMessage | undefined, >(items: TItems, message: TMessage): LooseTupleSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function looseTupleAsync( items: TupleItemsAsync, message?: ErrorMessage diff --git a/library/src/schemas/map/map.ts b/library/src/schemas/map/map.ts index c28a2276f..2f1646aa9 100644 --- a/library/src/schemas/map/map.ts +++ b/library/src/schemas/map/map.ts @@ -79,6 +79,7 @@ export function map< message: TMessage ): MapSchema; +// @__NO_SIDE_EFFECTS__ export function map( key: BaseSchema>, value: BaseSchema>, diff --git a/library/src/schemas/map/mapAsync.ts b/library/src/schemas/map/mapAsync.ts index fe6b19ef7..d90c50b2a 100644 --- a/library/src/schemas/map/mapAsync.ts +++ b/library/src/schemas/map/mapAsync.ts @@ -92,6 +92,7 @@ export function mapAsync< message: TMessage ): MapSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function mapAsync( key: | BaseSchema> diff --git a/library/src/schemas/nan/nan.ts b/library/src/schemas/nan/nan.ts index b23f82c6e..09378c846 100644 --- a/library/src/schemas/nan/nan.ts +++ b/library/src/schemas/nan/nan.ts @@ -65,6 +65,7 @@ export function nan | undefined>( message: TMessage ): NanSchema; +// @__NO_SIDE_EFFECTS__ export function nan( message?: ErrorMessage ): NanSchema | undefined> { diff --git a/library/src/schemas/never/never.ts b/library/src/schemas/never/never.ts index 3084ece19..907154244 100644 --- a/library/src/schemas/never/never.ts +++ b/library/src/schemas/never/never.ts @@ -66,6 +66,7 @@ export function never< const TMessage extends ErrorMessage | undefined, >(message: TMessage): NeverSchema; +// @__NO_SIDE_EFFECTS__ export function never( message?: ErrorMessage ): NeverSchema | undefined> { diff --git a/library/src/schemas/nonNullable/nonNullable.ts b/library/src/schemas/nonNullable/nonNullable.ts index 6f3f434d5..2039ad91b 100644 --- a/library/src/schemas/nonNullable/nonNullable.ts +++ b/library/src/schemas/nonNullable/nonNullable.ts @@ -69,6 +69,7 @@ export function nonNullable< const TMessage extends ErrorMessage | undefined, >(wrapped: TWrapped, message: TMessage): NonNullableSchema; +// @__NO_SIDE_EFFECTS__ export function nonNullable( wrapped: BaseSchema>, message?: ErrorMessage | undefined diff --git a/library/src/schemas/nonNullable/nonNullableAsync.ts b/library/src/schemas/nonNullable/nonNullableAsync.ts index 111c4796c..d81aaf5b7 100644 --- a/library/src/schemas/nonNullable/nonNullableAsync.ts +++ b/library/src/schemas/nonNullable/nonNullableAsync.ts @@ -79,6 +79,7 @@ export function nonNullableAsync< message: TMessage ): NonNullableSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function nonNullableAsync( wrapped: | BaseSchema> diff --git a/library/src/schemas/nonNullish/nonNullish.ts b/library/src/schemas/nonNullish/nonNullish.ts index 050baa3e0..0dacdc3f4 100644 --- a/library/src/schemas/nonNullish/nonNullish.ts +++ b/library/src/schemas/nonNullish/nonNullish.ts @@ -69,6 +69,7 @@ export function nonNullish< const TMessage extends ErrorMessage | undefined, >(wrapped: TWrapped, message: TMessage): NonNullishSchema; +// @__NO_SIDE_EFFECTS__ export function nonNullish( wrapped: BaseSchema>, message?: ErrorMessage | undefined diff --git a/library/src/schemas/nonNullish/nonNullishAsync.ts b/library/src/schemas/nonNullish/nonNullishAsync.ts index 15243971a..29b9cc942 100644 --- a/library/src/schemas/nonNullish/nonNullishAsync.ts +++ b/library/src/schemas/nonNullish/nonNullishAsync.ts @@ -79,6 +79,7 @@ export function nonNullishAsync< message: TMessage ): NonNullishSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function nonNullishAsync( wrapped: | BaseSchema> diff --git a/library/src/schemas/nonOptional/nonOptional.ts b/library/src/schemas/nonOptional/nonOptional.ts index d21ce39c5..bba50e232 100644 --- a/library/src/schemas/nonOptional/nonOptional.ts +++ b/library/src/schemas/nonOptional/nonOptional.ts @@ -69,6 +69,7 @@ export function nonOptional< const TMessage extends ErrorMessage | undefined, >(wrapped: TWrapped, message: TMessage): NonOptionalSchema; +// @__NO_SIDE_EFFECTS__ export function nonOptional( wrapped: BaseSchema>, message?: ErrorMessage | undefined diff --git a/library/src/schemas/nonOptional/nonOptionalAsync.ts b/library/src/schemas/nonOptional/nonOptionalAsync.ts index 040cf6f21..7914a309a 100644 --- a/library/src/schemas/nonOptional/nonOptionalAsync.ts +++ b/library/src/schemas/nonOptional/nonOptionalAsync.ts @@ -79,6 +79,7 @@ export function nonOptionalAsync< message: TMessage ): NonOptionalSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function nonOptionalAsync( wrapped: | BaseSchema> diff --git a/library/src/schemas/null/null.ts b/library/src/schemas/null/null.ts index 1f4c3a223..61621e690 100644 --- a/library/src/schemas/null/null.ts +++ b/library/src/schemas/null/null.ts @@ -66,6 +66,7 @@ export function null_< const TMessage extends ErrorMessage | undefined, >(message: TMessage): NullSchema; +// @__NO_SIDE_EFFECTS__ export function null_( message?: ErrorMessage ): NullSchema | undefined> { diff --git a/library/src/schemas/nullable/nullable.ts b/library/src/schemas/nullable/nullable.ts index 20a25b731..a8e775bb8 100644 --- a/library/src/schemas/nullable/nullable.ts +++ b/library/src/schemas/nullable/nullable.ts @@ -67,6 +67,7 @@ export function nullable< const TDefault extends Default, >(wrapped: TWrapped, default_: TDefault): NullableSchema; +// @__NO_SIDE_EFFECTS__ export function nullable( wrapped: BaseSchema>, default_?: unknown diff --git a/library/src/schemas/nullable/nullableAsync.ts b/library/src/schemas/nullable/nullableAsync.ts index 929da4427..dbd95a7fb 100644 --- a/library/src/schemas/nullable/nullableAsync.ts +++ b/library/src/schemas/nullable/nullableAsync.ts @@ -77,6 +77,7 @@ export function nullableAsync< default_: TDefault ): NullableSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function nullableAsync( wrapped: | BaseSchema> diff --git a/library/src/schemas/nullish/nullish.ts b/library/src/schemas/nullish/nullish.ts index 00d72fc11..085abe669 100644 --- a/library/src/schemas/nullish/nullish.ts +++ b/library/src/schemas/nullish/nullish.ts @@ -67,6 +67,7 @@ export function nullish< const TDefault extends Default, >(wrapped: TWrapped, default_: TDefault): NullishSchema; +// @__NO_SIDE_EFFECTS__ export function nullish( wrapped: BaseSchema>, default_?: unknown diff --git a/library/src/schemas/nullish/nullishAsync.ts b/library/src/schemas/nullish/nullishAsync.ts index 39bcac974..d49a2dbdc 100644 --- a/library/src/schemas/nullish/nullishAsync.ts +++ b/library/src/schemas/nullish/nullishAsync.ts @@ -77,6 +77,7 @@ export function nullishAsync< default_: TDefault ): NullishSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function nullishAsync( wrapped: | BaseSchema> diff --git a/library/src/schemas/number/number.ts b/library/src/schemas/number/number.ts index 2d2dcf283..734878705 100644 --- a/library/src/schemas/number/number.ts +++ b/library/src/schemas/number/number.ts @@ -66,6 +66,7 @@ export function number< const TMessage extends ErrorMessage | undefined, >(message: TMessage): NumberSchema; +// @__NO_SIDE_EFFECTS__ export function number( message?: ErrorMessage ): NumberSchema | undefined> { diff --git a/library/src/schemas/object/object.ts b/library/src/schemas/object/object.ts index 622064b26..c632752d5 100644 --- a/library/src/schemas/object/object.ts +++ b/library/src/schemas/object/object.ts @@ -78,6 +78,7 @@ export function object< const TMessage extends ErrorMessage | undefined, >(entries: TEntries, message: TMessage): ObjectSchema; +// @__NO_SIDE_EFFECTS__ export function object( entries: ObjectEntries, message?: ErrorMessage diff --git a/library/src/schemas/object/objectAsync.ts b/library/src/schemas/object/objectAsync.ts index edfb29b24..3cb23f3d6 100644 --- a/library/src/schemas/object/objectAsync.ts +++ b/library/src/schemas/object/objectAsync.ts @@ -78,6 +78,7 @@ export function objectAsync< const TMessage extends ErrorMessage | undefined, >(entries: TEntries, message: TMessage): ObjectSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function objectAsync( entries: ObjectEntriesAsync, message?: ErrorMessage diff --git a/library/src/schemas/objectWithRest/objectWithRest.ts b/library/src/schemas/objectWithRest/objectWithRest.ts index 5c12b1e54..b6855bb7b 100644 --- a/library/src/schemas/objectWithRest/objectWithRest.ts +++ b/library/src/schemas/objectWithRest/objectWithRest.ts @@ -92,6 +92,7 @@ export function objectWithRest< message: TMessage ): ObjectWithRestSchema; +// @__NO_SIDE_EFFECTS__ export function objectWithRest( entries: ObjectEntries, rest: BaseSchema>, diff --git a/library/src/schemas/objectWithRest/objectWithRestAsync.ts b/library/src/schemas/objectWithRest/objectWithRestAsync.ts index e8aeddbbd..774fd8405 100644 --- a/library/src/schemas/objectWithRest/objectWithRestAsync.ts +++ b/library/src/schemas/objectWithRest/objectWithRestAsync.ts @@ -99,6 +99,7 @@ export function objectWithRestAsync< message: TMessage ): ObjectWithRestSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function objectWithRestAsync( entries: ObjectEntriesAsync, rest: diff --git a/library/src/schemas/optional/optional.ts b/library/src/schemas/optional/optional.ts index f775572fc..076b6b580 100644 --- a/library/src/schemas/optional/optional.ts +++ b/library/src/schemas/optional/optional.ts @@ -67,6 +67,7 @@ export function optional< const TDefault extends Default, >(wrapped: TWrapped, default_: TDefault): OptionalSchema; +// @__NO_SIDE_EFFECTS__ export function optional( wrapped: BaseSchema>, default_?: unknown diff --git a/library/src/schemas/picklist/picklist.ts b/library/src/schemas/picklist/picklist.ts index 82b076e08..92f953d02 100644 --- a/library/src/schemas/picklist/picklist.ts +++ b/library/src/schemas/picklist/picklist.ts @@ -84,6 +84,7 @@ export function picklist< const TMessage extends ErrorMessage | undefined, >(options: TOptions, message: TMessage): PicklistSchema; +// @__NO_SIDE_EFFECTS__ export function picklist( options: PicklistOptions, message?: ErrorMessage diff --git a/library/src/schemas/promise/promise.ts b/library/src/schemas/promise/promise.ts index 0b9de5347..598b63385 100644 --- a/library/src/schemas/promise/promise.ts +++ b/library/src/schemas/promise/promise.ts @@ -66,6 +66,7 @@ export function promise< const TMessage extends ErrorMessage | undefined, >(message: TMessage): PromiseSchema; +// @__NO_SIDE_EFFECTS__ export function promise( message?: ErrorMessage ): PromiseSchema | undefined> { diff --git a/library/src/schemas/record/record.ts b/library/src/schemas/record/record.ts index 147b78961..8574f767a 100644 --- a/library/src/schemas/record/record.ts +++ b/library/src/schemas/record/record.ts @@ -95,6 +95,7 @@ export function record< message: TMessage ): RecordSchema; +// @__NO_SIDE_EFFECTS__ export function record( key: BaseSchema>, value: BaseSchema>, diff --git a/library/src/schemas/record/recordAsync.ts b/library/src/schemas/record/recordAsync.ts index 7c2d46f48..313573ca7 100644 --- a/library/src/schemas/record/recordAsync.ts +++ b/library/src/schemas/record/recordAsync.ts @@ -100,6 +100,7 @@ export function recordAsync< message: TMessage ): RecordSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function recordAsync( key: | BaseSchema> diff --git a/library/src/schemas/set/set.ts b/library/src/schemas/set/set.ts index 80d2a14a4..7758df0eb 100644 --- a/library/src/schemas/set/set.ts +++ b/library/src/schemas/set/set.ts @@ -66,6 +66,7 @@ export function set< const TMessage extends ErrorMessage | undefined, >(value: TValue, message: TMessage): SetSchema; +// @__NO_SIDE_EFFECTS__ export function set( value: BaseSchema>, message?: ErrorMessage diff --git a/library/src/schemas/set/setAsync.ts b/library/src/schemas/set/setAsync.ts index 1c67c4922..0ff0c6636 100644 --- a/library/src/schemas/set/setAsync.ts +++ b/library/src/schemas/set/setAsync.ts @@ -73,6 +73,7 @@ export function setAsync< const TMessage extends ErrorMessage | undefined, >(value: TValue, message: TMessage): SetSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function setAsync( value: | BaseSchema> diff --git a/library/src/schemas/strictObject/strictObject.ts b/library/src/schemas/strictObject/strictObject.ts index 96acbe6a8..423b7ed26 100644 --- a/library/src/schemas/strictObject/strictObject.ts +++ b/library/src/schemas/strictObject/strictObject.ts @@ -68,6 +68,7 @@ export function strictObject< const TMessage extends ErrorMessage | undefined, >(entries: TEntries, message: TMessage): StrictObjectSchema; +// @__NO_SIDE_EFFECTS__ export function strictObject( entries: ObjectEntries, message?: ErrorMessage diff --git a/library/src/schemas/strictObject/strictObjectAsync.ts b/library/src/schemas/strictObject/strictObjectAsync.ts index 8ba432ef6..ec797e34c 100644 --- a/library/src/schemas/strictObject/strictObjectAsync.ts +++ b/library/src/schemas/strictObject/strictObjectAsync.ts @@ -71,6 +71,7 @@ export function strictObjectAsync< message: TMessage ): StrictObjectSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function strictObjectAsync( entries: ObjectEntriesAsync, message?: ErrorMessage diff --git a/library/src/schemas/strictTuple/strictTuple.ts b/library/src/schemas/strictTuple/strictTuple.ts index 608c9c55a..9226b58bd 100644 --- a/library/src/schemas/strictTuple/strictTuple.ts +++ b/library/src/schemas/strictTuple/strictTuple.ts @@ -69,6 +69,7 @@ export function strictTuple< const TMessage extends ErrorMessage | undefined, >(items: TItems, message: TMessage): StrictTupleSchema; +// @__NO_SIDE_EFFECTS__ export function strictTuple( items: TupleItems, message?: ErrorMessage diff --git a/library/src/schemas/strictTuple/strictTupleAsync.ts b/library/src/schemas/strictTuple/strictTupleAsync.ts index ffd84f56b..525922cdd 100644 --- a/library/src/schemas/strictTuple/strictTupleAsync.ts +++ b/library/src/schemas/strictTuple/strictTupleAsync.ts @@ -69,6 +69,7 @@ export function strictTupleAsync< const TMessage extends ErrorMessage | undefined, >(items: TItems, message: TMessage): StrictTupleSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function strictTupleAsync( items: TupleItemsAsync, message?: ErrorMessage diff --git a/library/src/schemas/string/string.ts b/library/src/schemas/string/string.ts index a2bf3878e..d727dc16c 100644 --- a/library/src/schemas/string/string.ts +++ b/library/src/schemas/string/string.ts @@ -66,6 +66,7 @@ export function string< const TMessage extends ErrorMessage | undefined, >(message: TMessage): StringSchema; +// @__NO_SIDE_EFFECTS__ export function string( message?: ErrorMessage ): StringSchema | undefined> { diff --git a/library/src/schemas/symbol/symbol.ts b/library/src/schemas/symbol/symbol.ts index 878fc1129..9a32e2ff6 100644 --- a/library/src/schemas/symbol/symbol.ts +++ b/library/src/schemas/symbol/symbol.ts @@ -66,6 +66,7 @@ export function symbol< const TMessage extends ErrorMessage | undefined, >(message: TMessage): SymbolSchema; +// @__NO_SIDE_EFFECTS__ export function symbol( message?: ErrorMessage ): SymbolSchema | undefined> { diff --git a/library/src/schemas/tuple/tuple.ts b/library/src/schemas/tuple/tuple.ts index be0e6d788..3747a3dc6 100644 --- a/library/src/schemas/tuple/tuple.ts +++ b/library/src/schemas/tuple/tuple.ts @@ -79,6 +79,7 @@ export function tuple< const TMessage extends ErrorMessage | undefined, >(items: TItems, message: TMessage): TupleSchema; +// @__NO_SIDE_EFFECTS__ export function tuple( items: TupleItems, message?: ErrorMessage diff --git a/library/src/schemas/tuple/tupleAsync.ts b/library/src/schemas/tuple/tupleAsync.ts index 31bf3a334..1e2620274 100644 --- a/library/src/schemas/tuple/tupleAsync.ts +++ b/library/src/schemas/tuple/tupleAsync.ts @@ -79,6 +79,7 @@ export function tupleAsync< const TMessage extends ErrorMessage | undefined, >(items: TItems, message: TMessage): TupleSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function tupleAsync( items: TupleItemsAsync, message?: ErrorMessage diff --git a/library/src/schemas/tupleWithRest/tupleWithRest.ts b/library/src/schemas/tupleWithRest/tupleWithRest.ts index d4fa947f5..c4e4f8355 100644 --- a/library/src/schemas/tupleWithRest/tupleWithRest.ts +++ b/library/src/schemas/tupleWithRest/tupleWithRest.ts @@ -85,6 +85,7 @@ export function tupleWithRest< message: TMessage ): TupleWithRestSchema; +// @__NO_SIDE_EFFECTS__ export function tupleWithRest( items: TupleItems, rest: BaseSchema>, diff --git a/library/src/schemas/tupleWithRest/tupleWithRestAsync.ts b/library/src/schemas/tupleWithRest/tupleWithRestAsync.ts index f8de07ed9..f909e4697 100644 --- a/library/src/schemas/tupleWithRest/tupleWithRestAsync.ts +++ b/library/src/schemas/tupleWithRest/tupleWithRestAsync.ts @@ -95,6 +95,7 @@ export function tupleWithRestAsync< message: TMessage ): TupleWithRestSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function tupleWithRestAsync( items: TupleItemsAsync, rest: diff --git a/library/src/schemas/undefined/undefined.ts b/library/src/schemas/undefined/undefined.ts index fc9f03891..82b75afec 100644 --- a/library/src/schemas/undefined/undefined.ts +++ b/library/src/schemas/undefined/undefined.ts @@ -66,6 +66,7 @@ export function undefined_< const TMessage extends ErrorMessage | undefined, >(message: TMessage): UndefinedSchema; +// @__NO_SIDE_EFFECTS__ export function undefined_( message?: ErrorMessage ): UndefinedSchema | undefined> { diff --git a/library/src/schemas/undefinedable/undefinedable.ts b/library/src/schemas/undefinedable/undefinedable.ts index 5dd68c444..96649445b 100644 --- a/library/src/schemas/undefinedable/undefinedable.ts +++ b/library/src/schemas/undefinedable/undefinedable.ts @@ -70,6 +70,7 @@ export function undefinedable< default_: TDefault ): UndefinedableSchema; +// @__NO_SIDE_EFFECTS__ export function undefinedable( wrapped: BaseSchema>, default_?: unknown diff --git a/library/src/schemas/undefinedable/undefinedableAsync.ts b/library/src/schemas/undefinedable/undefinedableAsync.ts index e46370ba1..f5648bcc2 100644 --- a/library/src/schemas/undefinedable/undefinedableAsync.ts +++ b/library/src/schemas/undefinedable/undefinedableAsync.ts @@ -77,6 +77,7 @@ export function undefinedableAsync< default_: TDefault ): UndefinedableSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function undefinedableAsync( wrapped: | BaseSchema> diff --git a/library/src/schemas/union/union.ts b/library/src/schemas/union/union.ts index 68454a0f8..fac4a98f8 100644 --- a/library/src/schemas/union/union.ts +++ b/library/src/schemas/union/union.ts @@ -83,6 +83,7 @@ export function union< | undefined, >(options: TOptions, message: TMessage): UnionSchema; +// @__NO_SIDE_EFFECTS__ export function union( options: UnionOptions, message?: ErrorMessage>> diff --git a/library/src/schemas/union/unionAsync.ts b/library/src/schemas/union/unionAsync.ts index 71d1643e7..ced4405e5 100644 --- a/library/src/schemas/union/unionAsync.ts +++ b/library/src/schemas/union/unionAsync.ts @@ -87,6 +87,7 @@ export function unionAsync< | undefined, >(options: TOptions, message: TMessage): UnionSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function unionAsync( options: UnionOptionsAsync, message?: ErrorMessage>> diff --git a/library/src/schemas/unknown/unknown.ts b/library/src/schemas/unknown/unknown.ts index 71b147b4d..0fc97534f 100644 --- a/library/src/schemas/unknown/unknown.ts +++ b/library/src/schemas/unknown/unknown.ts @@ -23,6 +23,8 @@ export interface UnknownSchema extends BaseSchema { * Creates a unknown schema. * * @returns A unknown schema. + * + * @__NO_SIDE_EFFECTS__ */ export function unknown(): UnknownSchema { return { diff --git a/library/src/schemas/variant/variant.ts b/library/src/schemas/variant/variant.ts index b6ee84c5a..7d43cb471 100644 --- a/library/src/schemas/variant/variant.ts +++ b/library/src/schemas/variant/variant.ts @@ -88,6 +88,7 @@ export function variant< message: TMessage ): VariantSchema; +// @__NO_SIDE_EFFECTS__ export function variant( key: string, options: VariantOptions, diff --git a/library/src/schemas/variant/variantAsync.ts b/library/src/schemas/variant/variantAsync.ts index 97b018167..2ad79b6e6 100644 --- a/library/src/schemas/variant/variantAsync.ts +++ b/library/src/schemas/variant/variantAsync.ts @@ -89,6 +89,7 @@ export function variantAsync< message: TMessage ): VariantSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function variantAsync( key: string, options: VariantOptionsAsync, diff --git a/library/src/schemas/void/void.ts b/library/src/schemas/void/void.ts index cca4c5dde..3433f0408 100644 --- a/library/src/schemas/void/void.ts +++ b/library/src/schemas/void/void.ts @@ -66,6 +66,7 @@ export function void_< const TMessage extends ErrorMessage | undefined, >(message: TMessage): VoidSchema; +// @__NO_SIDE_EFFECTS__ export function void_( message?: ErrorMessage ): VoidSchema | undefined> { From 3c06cef6fa84f81f54288ad809d7638a1d4cf0fa Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 24 Dec 2024 20:30:20 +0800 Subject: [PATCH 2/4] chore: add co-author Co-authored-by: serkodev From 63afefaf2ee762965fcf25cd9e2e13a4d079fd5b Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Wed, 25 Dec 2024 10:15:38 +0800 Subject: [PATCH 3/4] chore: add missing files --- library/src/actions/notSize/notSize.ts | 1 + library/src/schemas/optional/optionalAsync.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/library/src/actions/notSize/notSize.ts b/library/src/actions/notSize/notSize.ts index f56f819de..9bd549519 100644 --- a/library/src/actions/notSize/notSize.ts +++ b/library/src/actions/notSize/notSize.ts @@ -96,6 +96,7 @@ export function notSize< message: TMessage ): NotSizeAction; +// @__NO_SIDE_EFFECTS__ export function notSize( requirement: number, message?: ErrorMessage> diff --git a/library/src/schemas/optional/optionalAsync.ts b/library/src/schemas/optional/optionalAsync.ts index 6d6c9afff..529f39c40 100644 --- a/library/src/schemas/optional/optionalAsync.ts +++ b/library/src/schemas/optional/optionalAsync.ts @@ -77,6 +77,7 @@ export function optionalAsync< default_: TDefault ): OptionalSchemaAsync; +// @__NO_SIDE_EFFECTS__ export function optionalAsync( wrapped: | BaseSchema> From 2f59f25b2d0dee65da2661a70af680effe7a4c4b Mon Sep 17 00:00:00 2001 From: Fabian Hiller Date: Wed, 25 Dec 2024 22:56:29 -0500 Subject: [PATCH 4/4] Add missing @__NO_SIDE_EFFECTS__ notation to library --- library/CHANGELOG.md | 1 + library/src/actions/await/awaitAsync.ts | 3 +-- library/src/actions/brand/brand.ts | 3 +-- library/src/actions/description/description.ts | 3 +-- library/src/actions/filterItems/filterItems.ts | 1 + library/src/actions/findItem/findItem.ts | 1 + library/src/actions/metadata/metadata.ts | 1 + library/src/actions/mimeType/mimeType.ts | 1 + library/src/actions/minGraphemes/minGraphemes.ts | 1 + library/src/actions/minValue/minValue.ts | 1 + .../partialCheck/utils/_isPartiallyTyped/_isPartiallyTyped.ts | 1 + library/src/actions/rawCheck/rawCheck.ts | 3 +-- library/src/actions/rawCheck/rawCheckAsync.ts | 3 +-- library/src/actions/rawTransform/rawTransform.ts | 3 +-- library/src/actions/rawTransform/rawTransformAsync.ts | 3 +-- library/src/actions/readonly/readonly.ts | 3 +-- library/src/actions/title/title.ts | 3 +-- library/src/actions/toLowerCase/toLowerCase.ts | 3 +-- library/src/actions/toMaxValue/toMaxValue.ts | 3 +-- library/src/actions/toMinValue/toMinValue.ts | 3 +-- library/src/actions/toUpperCase/toUpperCase.ts | 3 +-- library/src/actions/transform/transform.ts | 3 +-- library/src/actions/transform/transformAsync.ts | 3 +-- library/src/actions/trim/trim.ts | 3 +-- library/src/actions/trimEnd/trimEnd.ts | 3 +-- library/src/actions/trimStart/trimStart.ts | 1 + library/src/methods/assert/assert.ts | 3 +-- library/src/methods/config/config.ts | 3 +-- library/src/methods/fallback/fallback.ts | 3 +-- library/src/methods/fallback/fallbackAsync.ts | 3 +-- library/src/methods/forward/forward.ts | 3 +-- library/src/methods/forward/forwardAsync.ts | 3 +-- library/src/methods/getDefault/getDefault.ts | 3 +-- library/src/methods/getDefaults/getDefaults.ts | 3 +-- library/src/methods/getDefaults/getDefaultsAsync.ts | 1 + library/src/methods/getFallback/getFallback.ts | 1 + library/src/methods/getFallbacks/getFallbacks.ts | 3 +-- library/src/methods/getFallbacks/getFallbacksAsync.ts | 1 + library/src/methods/is/is.ts | 3 +-- library/src/methods/omit/omit.ts | 3 +-- library/src/methods/parse/parse.ts | 3 +-- library/src/methods/parse/parseAsync.ts | 1 + library/src/methods/pick/pick.ts | 3 +-- library/src/methods/safeParse/safeParse.ts | 3 +-- library/src/methods/safeParse/safeParseAsync.ts | 1 + library/src/methods/unwrap/unwrap.ts | 3 +-- library/src/schemas/any/any.ts | 3 +-- library/src/schemas/intersect/utils/_merge/_merge.ts | 1 + library/src/schemas/lazy/lazy.ts | 3 +-- library/src/schemas/lazy/lazyAsync.ts | 3 +-- library/src/schemas/union/utils/_subIssues/_subIssues.ts | 1 + library/src/schemas/unknown/unknown.ts | 3 +-- library/src/storages/globalConfig/globalConfig.ts | 1 + library/src/storages/globalMessage/globalMessage.ts | 1 + library/src/storages/schemaMessage/schemaMessage.ts | 1 + library/src/storages/specificMessage/specificMessage.ts | 1 + library/src/utils/ValiError/ValiError.ts | 1 + library/src/utils/_addIssue/_addIssue.ts | 1 + library/src/utils/_getByteCount/_getByteCount.ts | 1 + library/src/utils/_getGraphemeCount/_getGraphemeCount.ts | 1 + library/src/utils/_getStandardProps/_getStandardProps.ts | 1 + library/src/utils/_getWordCount/_getWordCount.ts | 1 + library/src/utils/_isLuhnAlgo/_isLuhnAlgo.ts | 1 + library/src/utils/_isValidObjectKey/_isValidObjectKey.ts | 1 + library/src/utils/_joinExpects/_joinExpects.ts | 1 + library/src/utils/_stringify/_stringify.ts | 1 + library/src/utils/entriesFromList/entriesFromList.ts | 1 + library/src/utils/getDotPath/getDotPath.ts | 1 + library/src/utils/isOfKind/isOfKind.ts | 1 + library/src/utils/isOfType/isOfType.ts | 1 + library/src/utils/isValiError/isValiError.ts | 1 + 71 files changed, 71 insertions(+), 72 deletions(-) diff --git a/library/CHANGELOG.md b/library/CHANGELOG.md index 7d82620e6..6b9dfbcb6 100644 --- a/library/CHANGELOG.md +++ b/library/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to the library will be documented in this file. - Add `words`, `maxWords`, `minWords` and `notWords` action - Add `args` and `returns` action to transform functions (issue #243) - Add new overload signature to `pipe` and `pipeAync` method to support unlimited pipe items of same input and output type (issue #852) +- Add `@__NO_SIDE_EFFECTS__` notation to improve tree shaking (pull request #995) - Change types and implementation to support Standard Schema - Change behaviour of `minValue` and `maxValue` for `NaN` (pull request #843) - Change type and behaviour of `nullable`, `nullableAsync`, `nullish`, `nullishAsync`, `optional`, `optionalAsync`, `undefinedable` and `undefinedableAsync` for undefined default value (issue #878) diff --git a/library/src/actions/await/awaitAsync.ts b/library/src/actions/await/awaitAsync.ts index 2dee23e8d..6b58032be 100644 --- a/library/src/actions/await/awaitAsync.ts +++ b/library/src/actions/await/awaitAsync.ts @@ -22,9 +22,8 @@ export interface AwaitActionAsync> * Creates an await transformation action. * * @returns An await action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function awaitAsync< TInput extends Promise, >(): AwaitActionAsync { diff --git a/library/src/actions/brand/brand.ts b/library/src/actions/brand/brand.ts index d095b6d17..b39b08650 100644 --- a/library/src/actions/brand/brand.ts +++ b/library/src/actions/brand/brand.ts @@ -42,9 +42,8 @@ export interface BrandAction * @param name The brand name. * * @returns A brand action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function brand( name: TName ): BrandAction { diff --git a/library/src/actions/description/description.ts b/library/src/actions/description/description.ts index 5d8dcf3d1..987ededa5 100644 --- a/library/src/actions/description/description.ts +++ b/library/src/actions/description/description.ts @@ -25,9 +25,8 @@ export interface DescriptionAction * @param description_ The description text. * * @returns A description action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function description( description_: TDescription ): DescriptionAction { diff --git a/library/src/actions/filterItems/filterItems.ts b/library/src/actions/filterItems/filterItems.ts index 0b5156b22..5a5c33cb8 100644 --- a/library/src/actions/filterItems/filterItems.ts +++ b/library/src/actions/filterItems/filterItems.ts @@ -31,6 +31,7 @@ export function filterItems( operation: ArrayRequirement ): FilterItemsAction; +// @__NO_SIDE_EFFECTS__ export function filterItems( operation: ArrayRequirement ): FilterItemsAction { diff --git a/library/src/actions/findItem/findItem.ts b/library/src/actions/findItem/findItem.ts index 3a167e6ec..f6b19c722 100644 --- a/library/src/actions/findItem/findItem.ts +++ b/library/src/actions/findItem/findItem.ts @@ -44,6 +44,7 @@ export function findItem< TOuput extends TInput[number], >(operation: ArrayRequirement): FindItemAction; +// @__NO_SIDE_EFFECTS__ export function findItem( operation: ArrayRequirement ): FindItemAction { diff --git a/library/src/actions/metadata/metadata.ts b/library/src/actions/metadata/metadata.ts index c85f6c285..e7ec889a6 100644 --- a/library/src/actions/metadata/metadata.ts +++ b/library/src/actions/metadata/metadata.ts @@ -28,6 +28,7 @@ export interface MetadataAction< * * @returns A metadata action. */ +// @__NO_SIDE_EFFECTS__ export function metadata< TInput, const TMetadata extends Record, diff --git a/library/src/actions/mimeType/mimeType.ts b/library/src/actions/mimeType/mimeType.ts index f73991df4..d9dd664d4 100644 --- a/library/src/actions/mimeType/mimeType.ts +++ b/library/src/actions/mimeType/mimeType.ts @@ -102,6 +102,7 @@ export function mimeType< message: TMessage ): MimeTypeAction; +// @__NO_SIDE_EFFECTS__ export function mimeType( requirement: Requirement, message?: ErrorMessage> diff --git a/library/src/actions/minGraphemes/minGraphemes.ts b/library/src/actions/minGraphemes/minGraphemes.ts index 663a526f9..cd2a6e158 100644 --- a/library/src/actions/minGraphemes/minGraphemes.ts +++ b/library/src/actions/minGraphemes/minGraphemes.ts @@ -103,6 +103,7 @@ export function minGraphemes< message: TMessage ): MinGraphemesAction; +// @__NO_SIDE_EFFECTS__ export function minGraphemes( requirement: number, message?: ErrorMessage> diff --git a/library/src/actions/minValue/minValue.ts b/library/src/actions/minValue/minValue.ts index f6ada7ca0..c05d1dc16 100644 --- a/library/src/actions/minValue/minValue.ts +++ b/library/src/actions/minValue/minValue.ts @@ -94,6 +94,7 @@ export function minValue< message: TMessage ): MinValueAction; +// @__NO_SIDE_EFFECTS__ export function minValue( requirement: ValueInput, message?: ErrorMessage> diff --git a/library/src/actions/partialCheck/utils/_isPartiallyTyped/_isPartiallyTyped.ts b/library/src/actions/partialCheck/utils/_isPartiallyTyped/_isPartiallyTyped.ts index 4faa7f721..c989d989a 100644 --- a/library/src/actions/partialCheck/utils/_isPartiallyTyped/_isPartiallyTyped.ts +++ b/library/src/actions/partialCheck/utils/_isPartiallyTyped/_isPartiallyTyped.ts @@ -8,6 +8,7 @@ import type { BaseIssue, OutputDataset } from '../../../../types/index.ts'; * * @returns Whether it is partially typed. */ +// @__NO_SIDE_EFFECTS__ export function _isPartiallyTyped( dataset: OutputDataset>, pathList: readonly (readonly (string | number)[])[] diff --git a/library/src/actions/rawCheck/rawCheck.ts b/library/src/actions/rawCheck/rawCheck.ts index 44c4d6c1e..eb650289c 100644 --- a/library/src/actions/rawCheck/rawCheck.ts +++ b/library/src/actions/rawCheck/rawCheck.ts @@ -27,9 +27,8 @@ export interface RawCheckAction * @param action The validation action. * * @returns A raw check action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function rawCheck( action: (context: Context) => void ): RawCheckAction { diff --git a/library/src/actions/rawCheck/rawCheckAsync.ts b/library/src/actions/rawCheck/rawCheckAsync.ts index d7e6387e3..4d61f6221 100644 --- a/library/src/actions/rawCheck/rawCheckAsync.ts +++ b/library/src/actions/rawCheck/rawCheckAsync.ts @@ -27,9 +27,8 @@ export interface RawCheckActionAsync * @param action The validation action. * * @returns A raw check action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function rawCheckAsync( action: (context: Context) => MaybePromise ): RawCheckActionAsync { diff --git a/library/src/actions/rawTransform/rawTransform.ts b/library/src/actions/rawTransform/rawTransform.ts index e80e4c05d..f39cb5a0b 100644 --- a/library/src/actions/rawTransform/rawTransform.ts +++ b/library/src/actions/rawTransform/rawTransform.ts @@ -27,9 +27,8 @@ export interface RawTransformAction * @param action The transformation action. * * @returns A raw transform action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function rawTransform( action: (context: Context) => TOutput ): RawTransformAction { diff --git a/library/src/actions/rawTransform/rawTransformAsync.ts b/library/src/actions/rawTransform/rawTransformAsync.ts index 06a7847f4..f1727d9da 100644 --- a/library/src/actions/rawTransform/rawTransformAsync.ts +++ b/library/src/actions/rawTransform/rawTransformAsync.ts @@ -28,9 +28,8 @@ export interface RawTransformActionAsync * @param action The transformation action. * * @returns A raw transform action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function rawTransformAsync( action: (context: Context) => MaybePromise ): RawTransformActionAsync { diff --git a/library/src/actions/readonly/readonly.ts b/library/src/actions/readonly/readonly.ts index 08046558d..3fc003cd3 100644 --- a/library/src/actions/readonly/readonly.ts +++ b/library/src/actions/readonly/readonly.ts @@ -19,9 +19,8 @@ export interface ReadonlyAction * Creates a readonly transformation action. * * @returns A readonly action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function readonly(): ReadonlyAction { return { kind: 'transformation', diff --git a/library/src/actions/title/title.ts b/library/src/actions/title/title.ts index 5a677e3f6..bd8861414 100644 --- a/library/src/actions/title/title.ts +++ b/library/src/actions/title/title.ts @@ -25,9 +25,8 @@ export interface TitleAction * @param title_ The title text. * * @returns A title action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function title( title_: TTitle ): TitleAction { diff --git a/library/src/actions/toLowerCase/toLowerCase.ts b/library/src/actions/toLowerCase/toLowerCase.ts index d081c33f2..c5b7c7135 100644 --- a/library/src/actions/toLowerCase/toLowerCase.ts +++ b/library/src/actions/toLowerCase/toLowerCase.ts @@ -19,9 +19,8 @@ export interface ToLowerCaseAction * Creates a to lower case transformation action. * * @returns A to lower case action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function toLowerCase(): ToLowerCaseAction { return { kind: 'transformation', diff --git a/library/src/actions/toMaxValue/toMaxValue.ts b/library/src/actions/toMaxValue/toMaxValue.ts index 4da97f00a..c5cdf596e 100644 --- a/library/src/actions/toMaxValue/toMaxValue.ts +++ b/library/src/actions/toMaxValue/toMaxValue.ts @@ -28,9 +28,8 @@ export interface ToMaxValueAction< * @param requirement The maximum value. * * @returns A to max value action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function toMaxValue< TInput extends ValueInput, const TRequirement extends TInput, diff --git a/library/src/actions/toMinValue/toMinValue.ts b/library/src/actions/toMinValue/toMinValue.ts index b5342e819..f84569cb5 100644 --- a/library/src/actions/toMinValue/toMinValue.ts +++ b/library/src/actions/toMinValue/toMinValue.ts @@ -28,9 +28,8 @@ export interface ToMinValueAction< * @param requirement The minimum value. * * @returns A to min value action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function toMinValue< TInput extends ValueInput, const TRequirement extends TInput, diff --git a/library/src/actions/toUpperCase/toUpperCase.ts b/library/src/actions/toUpperCase/toUpperCase.ts index e0e829bc5..db488af44 100644 --- a/library/src/actions/toUpperCase/toUpperCase.ts +++ b/library/src/actions/toUpperCase/toUpperCase.ts @@ -19,9 +19,8 @@ export interface ToUpperCaseAction * Creates a to upper case transformation action. * * @returns A to upper case action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function toUpperCase(): ToUpperCaseAction { return { kind: 'transformation', diff --git a/library/src/actions/transform/transform.ts b/library/src/actions/transform/transform.ts index 0697a820d..06e9d3d2f 100644 --- a/library/src/actions/transform/transform.ts +++ b/library/src/actions/transform/transform.ts @@ -25,9 +25,8 @@ export interface TransformAction * @param operation The transformation operation. * * @returns A transform action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function transform( operation: (input: TInput) => TOutput ): TransformAction { diff --git a/library/src/actions/transform/transformAsync.ts b/library/src/actions/transform/transformAsync.ts index 6824c86fb..543b4c9dd 100644 --- a/library/src/actions/transform/transformAsync.ts +++ b/library/src/actions/transform/transformAsync.ts @@ -28,9 +28,8 @@ export interface TransformActionAsync * @param operation The transformation operation. * * @returns A transform action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function transformAsync( operation: (input: TInput) => Promise ): TransformActionAsync { diff --git a/library/src/actions/trim/trim.ts b/library/src/actions/trim/trim.ts index 826f26021..557190828 100644 --- a/library/src/actions/trim/trim.ts +++ b/library/src/actions/trim/trim.ts @@ -18,9 +18,8 @@ export interface TrimAction extends BaseTransformation { * Creates a trim transformation action. * * @returns A trim action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function trim(): TrimAction { return { kind: 'transformation', diff --git a/library/src/actions/trimEnd/trimEnd.ts b/library/src/actions/trimEnd/trimEnd.ts index e8d68a6ad..44c107f34 100644 --- a/library/src/actions/trimEnd/trimEnd.ts +++ b/library/src/actions/trimEnd/trimEnd.ts @@ -19,9 +19,8 @@ export interface TrimEndAction * Creates a trim end transformation action. * * @returns A trim end action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function trimEnd(): TrimEndAction { return { kind: 'transformation', diff --git a/library/src/actions/trimStart/trimStart.ts b/library/src/actions/trimStart/trimStart.ts index 0feb842c4..edd1a8aaa 100644 --- a/library/src/actions/trimStart/trimStart.ts +++ b/library/src/actions/trimStart/trimStart.ts @@ -20,6 +20,7 @@ export interface TrimStartAction * * @returns A trim start action. */ +// @__NO_SIDE_EFFECTS__ export function trimStart(): TrimStartAction { return { kind: 'transformation', diff --git a/library/src/methods/assert/assert.ts b/library/src/methods/assert/assert.ts index 3af1aec16..4dfbb61fd 100644 --- a/library/src/methods/assert/assert.ts +++ b/library/src/methods/assert/assert.ts @@ -7,9 +7,8 @@ import { ValiError } from '../../utils/index.ts'; * * @param schema The schema to be used. * @param input The input to be tested. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function assert< const TSchema extends BaseSchema>, >(schema: TSchema, input: unknown): asserts input is InferInput { diff --git a/library/src/methods/config/config.ts b/library/src/methods/config/config.ts index a0d4fa120..80b60a558 100644 --- a/library/src/methods/config/config.ts +++ b/library/src/methods/config/config.ts @@ -14,9 +14,8 @@ import { _getStandardProps } from '../../utils/index.ts'; * @param config The parse configuration. * * @returns The configured schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function config< const TSchema extends | BaseSchema> diff --git a/library/src/methods/fallback/fallback.ts b/library/src/methods/fallback/fallback.ts index 0a62401f9..ea559dec3 100644 --- a/library/src/methods/fallback/fallback.ts +++ b/library/src/methods/fallback/fallback.ts @@ -41,9 +41,8 @@ export type SchemaWithFallback< * @param fallback The fallback value. * * @returns The passed schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function fallback< const TSchema extends BaseSchema>, const TFallback extends Fallback, diff --git a/library/src/methods/fallback/fallbackAsync.ts b/library/src/methods/fallback/fallbackAsync.ts index 0c8a47f4a..2d1b3188e 100644 --- a/library/src/methods/fallback/fallbackAsync.ts +++ b/library/src/methods/fallback/fallbackAsync.ts @@ -77,9 +77,8 @@ export type SchemaWithFallbackAsync< * @param fallback The fallback value. * * @returns The passed schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function fallbackAsync< const TSchema extends | BaseSchema> diff --git a/library/src/methods/forward/forward.ts b/library/src/methods/forward/forward.ts index 8dd3cea9f..e24196f53 100644 --- a/library/src/methods/forward/forward.ts +++ b/library/src/methods/forward/forward.ts @@ -19,9 +19,8 @@ import type { * @param pathKeys The path keys. * * @returns The modified action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function forward< TInput extends Record | ArrayLike, TIssue extends BaseIssue, diff --git a/library/src/methods/forward/forwardAsync.ts b/library/src/methods/forward/forwardAsync.ts index 9c4e74f20..546566ed7 100644 --- a/library/src/methods/forward/forwardAsync.ts +++ b/library/src/methods/forward/forwardAsync.ts @@ -20,9 +20,8 @@ import type { * @param pathKeys The path keys. * * @returns The modified action. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function forwardAsync< TInput extends Record | ArrayLike, TIssue extends BaseIssue, diff --git a/library/src/methods/getDefault/getDefault.ts b/library/src/methods/getDefault/getDefault.ts index e9c6e2f9b..4c69d697f 100644 --- a/library/src/methods/getDefault/getDefault.ts +++ b/library/src/methods/getDefault/getDefault.ts @@ -105,9 +105,8 @@ export type InferDefault< * @param config The config if available. * * @returns The default value. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function getDefault< const TSchema extends | BaseSchema> diff --git a/library/src/methods/getDefaults/getDefaults.ts b/library/src/methods/getDefaults/getDefaults.ts index cb69f8181..574165ba5 100644 --- a/library/src/methods/getDefaults/getDefaults.ts +++ b/library/src/methods/getDefaults/getDefaults.ts @@ -36,9 +36,8 @@ import type { InferDefaults } from './types.ts'; * @param schema The schema to get them from. * * @returns The default values. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function getDefaults< const TSchema extends | BaseSchema> diff --git a/library/src/methods/getDefaults/getDefaultsAsync.ts b/library/src/methods/getDefaults/getDefaultsAsync.ts index 35282f24d..0c617cd87 100644 --- a/library/src/methods/getDefaults/getDefaultsAsync.ts +++ b/library/src/methods/getDefaults/getDefaultsAsync.ts @@ -48,6 +48,7 @@ import type { InferDefaults } from './types.ts'; * * @returns The default values. */ +// @__NO_SIDE_EFFECTS__ export async function getDefaultsAsync< const TSchema extends | BaseSchema> diff --git a/library/src/methods/getFallback/getFallback.ts b/library/src/methods/getFallback/getFallback.ts index 579589642..5a78463c6 100644 --- a/library/src/methods/getFallback/getFallback.ts +++ b/library/src/methods/getFallback/getFallback.ts @@ -46,6 +46,7 @@ export type InferFallback< * * @returns The fallback value. */ +// @__NO_SIDE_EFFECTS__ export function getFallback< const TSchema extends | BaseSchema> diff --git a/library/src/methods/getFallbacks/getFallbacks.ts b/library/src/methods/getFallbacks/getFallbacks.ts index 780ff3498..afcc9995f 100644 --- a/library/src/methods/getFallbacks/getFallbacks.ts +++ b/library/src/methods/getFallbacks/getFallbacks.ts @@ -36,9 +36,8 @@ import type { InferFallbacks } from './types.ts'; * @param schema The schema to get them from. * * @returns The fallback values. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function getFallbacks< const TSchema extends | BaseSchema> diff --git a/library/src/methods/getFallbacks/getFallbacksAsync.ts b/library/src/methods/getFallbacks/getFallbacksAsync.ts index 5f017067a..3597849fc 100644 --- a/library/src/methods/getFallbacks/getFallbacksAsync.ts +++ b/library/src/methods/getFallbacks/getFallbacksAsync.ts @@ -48,6 +48,7 @@ import type { InferFallbacks } from './types.ts'; * * @returns The fallback values. */ +// @__NO_SIDE_EFFECTS__ export async function getFallbacksAsync< const TSchema extends | BaseSchema> diff --git a/library/src/methods/is/is.ts b/library/src/methods/is/is.ts index 7593b7512..5ae99d858 100644 --- a/library/src/methods/is/is.ts +++ b/library/src/methods/is/is.ts @@ -8,9 +8,8 @@ import type { BaseIssue, BaseSchema, InferInput } from '../../types/index.ts'; * @param input The input to be tested. * * @returns Whether the input matches the schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function is< const TSchema extends BaseSchema>, >(schema: TSchema, input: unknown): input is InferInput { diff --git a/library/src/methods/omit/omit.ts b/library/src/methods/omit/omit.ts index 6f661f2ae..d556321c8 100644 --- a/library/src/methods/omit/omit.ts +++ b/library/src/methods/omit/omit.ts @@ -462,9 +462,8 @@ export type SchemaWithOmit< * @param keys The selected entries. * * @returns An object schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function omit< const TSchema extends Schema, const TKeys extends ObjectKeys, diff --git a/library/src/methods/parse/parse.ts b/library/src/methods/parse/parse.ts index 4f9e53ad9..2c2ce1c5e 100644 --- a/library/src/methods/parse/parse.ts +++ b/library/src/methods/parse/parse.ts @@ -16,9 +16,8 @@ import { ValiError } from '../../utils/index.ts'; * @param config The parse configuration. * * @returns The parsed input. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function parse< const TSchema extends BaseSchema>, >( diff --git a/library/src/methods/parse/parseAsync.ts b/library/src/methods/parse/parseAsync.ts index 329fefad2..09452865b 100644 --- a/library/src/methods/parse/parseAsync.ts +++ b/library/src/methods/parse/parseAsync.ts @@ -18,6 +18,7 @@ import { ValiError } from '../../utils/index.ts'; * * @returns The parsed input. */ +// @__NO_SIDE_EFFECTS__ export async function parseAsync< const TSchema extends | BaseSchema> diff --git a/library/src/methods/pick/pick.ts b/library/src/methods/pick/pick.ts index ae06744d7..78ee409ea 100644 --- a/library/src/methods/pick/pick.ts +++ b/library/src/methods/pick/pick.ts @@ -462,9 +462,8 @@ export type SchemaWithPick< * @param keys The selected entries. * * @returns An object schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function pick< const TSchema extends Schema, const TKeys extends ObjectKeys, diff --git a/library/src/methods/safeParse/safeParse.ts b/library/src/methods/safeParse/safeParse.ts index 73d0a5cf5..547fab41f 100644 --- a/library/src/methods/safeParse/safeParse.ts +++ b/library/src/methods/safeParse/safeParse.ts @@ -15,9 +15,8 @@ import type { SafeParseResult } from './types.ts'; * @param config The parse configuration. * * @returns The parse result. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function safeParse< const TSchema extends BaseSchema>, >( diff --git a/library/src/methods/safeParse/safeParseAsync.ts b/library/src/methods/safeParse/safeParseAsync.ts index c1ef35583..2de2191f6 100644 --- a/library/src/methods/safeParse/safeParseAsync.ts +++ b/library/src/methods/safeParse/safeParseAsync.ts @@ -17,6 +17,7 @@ import type { SafeParseResult } from './types.ts'; * * @returns The parse result. */ +// @__NO_SIDE_EFFECTS__ export async function safeParseAsync< const TSchema extends | BaseSchema> diff --git a/library/src/methods/unwrap/unwrap.ts b/library/src/methods/unwrap/unwrap.ts index 55180b6ec..dcbaac3e8 100644 --- a/library/src/methods/unwrap/unwrap.ts +++ b/library/src/methods/unwrap/unwrap.ts @@ -30,9 +30,8 @@ import type { * @param schema The schema to be unwrapped. * * @returns The unwrapped schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function unwrap< TSchema extends | NonNullableSchema< diff --git a/library/src/schemas/any/any.ts b/library/src/schemas/any/any.ts index a3b76ccea..adc1a61cd 100644 --- a/library/src/schemas/any/any.ts +++ b/library/src/schemas/any/any.ts @@ -28,9 +28,8 @@ export interface AnySchema extends BaseSchema { * unknown data. * * @returns An any schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function any(): AnySchema { return { kind: 'schema', diff --git a/library/src/schemas/intersect/utils/_merge/_merge.ts b/library/src/schemas/intersect/utils/_merge/_merge.ts index b231f8eaa..12bdbc245 100644 --- a/library/src/schemas/intersect/utils/_merge/_merge.ts +++ b/library/src/schemas/intersect/utils/_merge/_merge.ts @@ -15,6 +15,7 @@ type MergeDataset = * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _merge(value1: unknown, value2: unknown): MergeDataset { // Continue if data type of values match if (typeof value1 === typeof value2) { diff --git a/library/src/schemas/lazy/lazy.ts b/library/src/schemas/lazy/lazy.ts index 288c86980..75e8e2602 100644 --- a/library/src/schemas/lazy/lazy.ts +++ b/library/src/schemas/lazy/lazy.ts @@ -41,9 +41,8 @@ export interface LazySchema< * @param getter The schema getter. * * @returns A lazy schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function lazy< const TWrapped extends BaseSchema>, >(getter: (input: unknown) => TWrapped): LazySchema { diff --git a/library/src/schemas/lazy/lazyAsync.ts b/library/src/schemas/lazy/lazyAsync.ts index c9ddc8643..29dbc2eb7 100644 --- a/library/src/schemas/lazy/lazyAsync.ts +++ b/library/src/schemas/lazy/lazyAsync.ts @@ -45,9 +45,8 @@ export interface LazySchemaAsync< * @param getter The schema getter. * * @returns A lazy schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function lazyAsync< const TWrapped extends | BaseSchema> diff --git a/library/src/schemas/union/utils/_subIssues/_subIssues.ts b/library/src/schemas/union/utils/_subIssues/_subIssues.ts index 5f3d0854d..f0a37587f 100644 --- a/library/src/schemas/union/utils/_subIssues/_subIssues.ts +++ b/library/src/schemas/union/utils/_subIssues/_subIssues.ts @@ -9,6 +9,7 @@ import type { BaseIssue, OutputDataset } from '../../../../types/index.ts'; * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _subIssues( datasets: OutputDataset>[] | undefined ): [BaseIssue, ...BaseIssue[]] | undefined { diff --git a/library/src/schemas/unknown/unknown.ts b/library/src/schemas/unknown/unknown.ts index 0fc97534f..6dc0b594d 100644 --- a/library/src/schemas/unknown/unknown.ts +++ b/library/src/schemas/unknown/unknown.ts @@ -23,9 +23,8 @@ export interface UnknownSchema extends BaseSchema { * Creates a unknown schema. * * @returns A unknown schema. - * - * @__NO_SIDE_EFFECTS__ */ +// @__NO_SIDE_EFFECTS__ export function unknown(): UnknownSchema { return { kind: 'schema', diff --git a/library/src/storages/globalConfig/globalConfig.ts b/library/src/storages/globalConfig/globalConfig.ts index 6f196bc3f..5bb03db26 100644 --- a/library/src/storages/globalConfig/globalConfig.ts +++ b/library/src/storages/globalConfig/globalConfig.ts @@ -24,6 +24,7 @@ export function setGlobalConfig(config: GlobalConfig): void { * * @returns The configuration. */ +// @__NO_SIDE_EFFECTS__ export function getGlobalConfig>( config?: Config ): Config { diff --git a/library/src/storages/globalMessage/globalMessage.ts b/library/src/storages/globalMessage/globalMessage.ts index 52b916ba9..7bfc5e9be 100644 --- a/library/src/storages/globalMessage/globalMessage.ts +++ b/library/src/storages/globalMessage/globalMessage.ts @@ -24,6 +24,7 @@ export function setGlobalMessage( * * @returns The error message. */ +// @__NO_SIDE_EFFECTS__ export function getGlobalMessage( lang?: string ): ErrorMessage> | undefined { diff --git a/library/src/storages/schemaMessage/schemaMessage.ts b/library/src/storages/schemaMessage/schemaMessage.ts index c88310561..9504dfa4a 100644 --- a/library/src/storages/schemaMessage/schemaMessage.ts +++ b/library/src/storages/schemaMessage/schemaMessage.ts @@ -24,6 +24,7 @@ export function setSchemaMessage( * * @returns The error message. */ +// @__NO_SIDE_EFFECTS__ export function getSchemaMessage( lang?: string ): ErrorMessage> | undefined { diff --git a/library/src/storages/specificMessage/specificMessage.ts b/library/src/storages/specificMessage/specificMessage.ts index a763d1418..1d172e81c 100644 --- a/library/src/storages/specificMessage/specificMessage.ts +++ b/library/src/storages/specificMessage/specificMessage.ts @@ -55,6 +55,7 @@ export function setSpecificMessage( * * @returns The error message. */ +// @__NO_SIDE_EFFECTS__ export function getSpecificMessage( reference: TReference, lang?: string diff --git a/library/src/utils/ValiError/ValiError.ts b/library/src/utils/ValiError/ValiError.ts index 2bee81183..ca200a60f 100644 --- a/library/src/utils/ValiError/ValiError.ts +++ b/library/src/utils/ValiError/ValiError.ts @@ -23,6 +23,7 @@ export class ValiError< * * @param issues The error issues. */ + // @__NO_SIDE_EFFECTS__ constructor(issues: [InferIssue, ...InferIssue[]]) { super(issues[0].message); this.name = 'ValiError'; diff --git a/library/src/utils/_addIssue/_addIssue.ts b/library/src/utils/_addIssue/_addIssue.ts index ada16565e..263b8b1fd 100644 --- a/library/src/utils/_addIssue/_addIssue.ts +++ b/library/src/utils/_addIssue/_addIssue.ts @@ -61,6 +61,7 @@ interface Other { * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _addIssue( context: TContext & { expects?: string | null; diff --git a/library/src/utils/_getByteCount/_getByteCount.ts b/library/src/utils/_getByteCount/_getByteCount.ts index af4d7d4ae..872c69b96 100644 --- a/library/src/utils/_getByteCount/_getByteCount.ts +++ b/library/src/utils/_getByteCount/_getByteCount.ts @@ -9,6 +9,7 @@ let textEncoder: TextEncoder; * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _getByteCount(input: string): number { if (!textEncoder) { textEncoder = new TextEncoder(); diff --git a/library/src/utils/_getGraphemeCount/_getGraphemeCount.ts b/library/src/utils/_getGraphemeCount/_getGraphemeCount.ts index 468558470..fdc006fff 100644 --- a/library/src/utils/_getGraphemeCount/_getGraphemeCount.ts +++ b/library/src/utils/_getGraphemeCount/_getGraphemeCount.ts @@ -9,6 +9,7 @@ let segmenter: Intl.Segmenter; * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _getGraphemeCount(input: string): number { if (!segmenter) { segmenter = new Intl.Segmenter(); diff --git a/library/src/utils/_getStandardProps/_getStandardProps.ts b/library/src/utils/_getStandardProps/_getStandardProps.ts index be89e51bd..4b890887c 100644 --- a/library/src/utils/_getStandardProps/_getStandardProps.ts +++ b/library/src/utils/_getStandardProps/_getStandardProps.ts @@ -16,6 +16,7 @@ import type { * * @returns The Standard Schema properties. */ +// @__NO_SIDE_EFFECTS__ export function _getStandardProps< TSchema extends | BaseSchema> diff --git a/library/src/utils/_getWordCount/_getWordCount.ts b/library/src/utils/_getWordCount/_getWordCount.ts index 8657998d9..f4540a4f7 100644 --- a/library/src/utils/_getWordCount/_getWordCount.ts +++ b/library/src/utils/_getWordCount/_getWordCount.ts @@ -10,6 +10,7 @@ let store: Map; * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _getWordCount( locales: Intl.LocalesArgument, input: string diff --git a/library/src/utils/_isLuhnAlgo/_isLuhnAlgo.ts b/library/src/utils/_isLuhnAlgo/_isLuhnAlgo.ts index 4994a4db9..d91f49994 100644 --- a/library/src/utils/_isLuhnAlgo/_isLuhnAlgo.ts +++ b/library/src/utils/_isLuhnAlgo/_isLuhnAlgo.ts @@ -12,6 +12,7 @@ const NON_DIGIT_REGEX = /\D/gu; * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _isLuhnAlgo(input: string): boolean { // Remove any non-digit chars const number = input.replace(NON_DIGIT_REGEX, ''); diff --git a/library/src/utils/_isValidObjectKey/_isValidObjectKey.ts b/library/src/utils/_isValidObjectKey/_isValidObjectKey.ts index 788bbe1dd..f4e0f2138 100644 --- a/library/src/utils/_isValidObjectKey/_isValidObjectKey.ts +++ b/library/src/utils/_isValidObjectKey/_isValidObjectKey.ts @@ -9,6 +9,7 @@ * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _isValidObjectKey(object: object, key: string): boolean { return ( Object.hasOwn(object, key) && diff --git a/library/src/utils/_joinExpects/_joinExpects.ts b/library/src/utils/_joinExpects/_joinExpects.ts index 3d0187300..37465fdd5 100644 --- a/library/src/utils/_joinExpects/_joinExpects.ts +++ b/library/src/utils/_joinExpects/_joinExpects.ts @@ -8,6 +8,7 @@ * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _joinExpects(values: string[], separator: '&' | '|'): string { // Create list without duplicates const list = [...new Set(values)]; diff --git a/library/src/utils/_stringify/_stringify.ts b/library/src/utils/_stringify/_stringify.ts index 8af3458e2..98b267d54 100644 --- a/library/src/utils/_stringify/_stringify.ts +++ b/library/src/utils/_stringify/_stringify.ts @@ -7,6 +7,7 @@ * * @internal */ +// @__NO_SIDE_EFFECTS__ export function _stringify(input: unknown): string { const type = typeof input; if (type === 'string') { diff --git a/library/src/utils/entriesFromList/entriesFromList.ts b/library/src/utils/entriesFromList/entriesFromList.ts index bcaef954c..60c21daf2 100644 --- a/library/src/utils/entriesFromList/entriesFromList.ts +++ b/library/src/utils/entriesFromList/entriesFromList.ts @@ -12,6 +12,7 @@ import type { * * @returns The object entries. */ +// @__NO_SIDE_EFFECTS__ export function entriesFromList< const TList extends readonly (string | number | symbol)[], const TSchema extends diff --git a/library/src/utils/getDotPath/getDotPath.ts b/library/src/utils/getDotPath/getDotPath.ts index 36a2ba615..68435fef3 100644 --- a/library/src/utils/getDotPath/getDotPath.ts +++ b/library/src/utils/getDotPath/getDotPath.ts @@ -28,6 +28,7 @@ export function getDotPath< | BaseSchemaAsync>, >(issue: InferIssue): IssueDotPath | null; +// @__NO_SIDE_EFFECTS__ export function getDotPath(issue: BaseIssue): string | null { if (issue.path) { let key = ''; diff --git a/library/src/utils/isOfKind/isOfKind.ts b/library/src/utils/isOfKind/isOfKind.ts index b5ac72947..f54c6a19a 100644 --- a/library/src/utils/isOfKind/isOfKind.ts +++ b/library/src/utils/isOfKind/isOfKind.ts @@ -6,6 +6,7 @@ * * @returns Whether it matches. */ +// @__NO_SIDE_EFFECTS__ export function isOfKind< const TKind extends TObject['kind'], const TObject extends { kind: string }, diff --git a/library/src/utils/isOfType/isOfType.ts b/library/src/utils/isOfType/isOfType.ts index 254b338ad..03b0ba9c1 100644 --- a/library/src/utils/isOfType/isOfType.ts +++ b/library/src/utils/isOfType/isOfType.ts @@ -6,6 +6,7 @@ * * @returns Whether it matches. */ +// @__NO_SIDE_EFFECTS__ export function isOfType< const TType extends TObject['type'], const TObject extends { type: string }, diff --git a/library/src/utils/isValiError/isValiError.ts b/library/src/utils/isValiError/isValiError.ts index ca01fc8b6..f4151de2f 100644 --- a/library/src/utils/isValiError/isValiError.ts +++ b/library/src/utils/isValiError/isValiError.ts @@ -12,6 +12,7 @@ import { ValiError } from '../../utils/index.ts'; * * @returns Whether its a ValiError. */ +// @__NO_SIDE_EFFECTS__ export function isValiError< TSchema extends | BaseSchema>