From d42fa115cedac76c963114b1849326b464249997 Mon Sep 17 00:00:00 2001 From: Elton Lobo Date: Tue, 17 Dec 2024 00:21:45 +0530 Subject: [PATCH 1/5] add `ltValue` action --- library/src/actions/index.ts | 1 + library/src/actions/ltValue/index.ts | 1 + library/src/actions/ltValue/ltValue.ts | 127 +++++++++++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 library/src/actions/ltValue/index.ts create mode 100644 library/src/actions/ltValue/ltValue.ts diff --git a/library/src/actions/index.ts b/library/src/actions/index.ts index 0c37dd5ca..e5b2f24bb 100644 --- a/library/src/actions/index.ts +++ b/library/src/actions/index.ts @@ -37,6 +37,7 @@ export * from './isoTimeSecond/index.ts'; export * from './isoTimestamp/index.ts'; export * from './isoWeek/index.ts'; export * from './length/index.ts'; +export * from './ltValue/index.ts'; export * from './mac/index.ts'; export * from './mac48/index.ts'; export * from './mac64/index.ts'; diff --git a/library/src/actions/ltValue/index.ts b/library/src/actions/ltValue/index.ts new file mode 100644 index 000000000..a1d18f20d --- /dev/null +++ b/library/src/actions/ltValue/index.ts @@ -0,0 +1 @@ +export * from './ltValue.ts'; diff --git a/library/src/actions/ltValue/ltValue.ts b/library/src/actions/ltValue/ltValue.ts new file mode 100644 index 000000000..6ec92f055 --- /dev/null +++ b/library/src/actions/ltValue/ltValue.ts @@ -0,0 +1,127 @@ +import type { + BaseIssue, + BaseValidation, + ErrorMessage, +} from '../../types/index.ts'; +import { _addIssue, _stringify } from '../../utils/index.ts'; +import type { ValueInput } from '../types.ts'; + +/** + * Less than value issue type. + */ +export interface LtValueIssue< + TInput extends ValueInput, + TRequirement extends TInput, +> extends BaseIssue { + /** + * The issue kind. + */ + readonly kind: 'validation'; + /** + * The issue type. + */ + readonly type: 'lt_value'; + /** + * The expected property. + */ + readonly expected: `<${string}`; + /** + * The less than value. + */ + readonly requirement: TRequirement; +} + +/** + * Less than value action type. + */ +export interface LtValueAction< + TInput extends ValueInput, + TRequirement extends TInput, + TMessage extends ErrorMessage> | undefined, +> extends BaseValidation> { + /** + * The action type. + */ + readonly type: 'lt_value'; + /** + * The action reference. + */ + readonly reference: typeof ltValue; + /** + * The expected property. + */ + readonly expects: `<${string}`; + /** + * The less than value. + */ + readonly requirement: TRequirement; + /** + * The error message. + */ + readonly message: TMessage; +} + +/** + * Creates a less than value validation action. + * + * @param requirement The less than value. + * + * @returns A less than value action. + */ +export function ltValue< + TInput extends ValueInput, + const TRequirement extends TInput, +>(requirement: TRequirement): LtValueAction; + +/** + * Creates a less than value validation action. + * + * @param requirement The less than value. + * @param message The error message. + * + * @returns A less than value action. + */ +export function ltValue< + TInput extends ValueInput, + const TRequirement extends TInput, + const TMessage extends + | ErrorMessage> + | undefined, +>( + requirement: TRequirement, + message: TMessage +): LtValueAction; + +export function ltValue( + requirement: ValueInput, + message?: ErrorMessage> +): LtValueAction< + ValueInput, + ValueInput, + ErrorMessage> | undefined +> { + return { + kind: 'validation', + type: 'lt_value', + reference: ltValue, + async: false, + expects: `<${ + requirement instanceof Date + ? requirement.toJSON() + : _stringify(requirement) + }`, + requirement, + message, + '~run'(dataset, config) { + if (dataset.typed && !(dataset.value < this.requirement)) { + _addIssue(this, 'value', dataset, config, { + received: + dataset.value instanceof Date + ? dataset.value.toJSON() + : _stringify(dataset.value), + }); + } + return dataset; + }, + }; +} From 8cabdbbbc4ffca0cf1c1cd7ef23d819df47daf94 Mon Sep 17 00:00:00 2001 From: Elton Lobo Date: Wed, 18 Dec 2024 23:55:25 +0530 Subject: [PATCH 2/5] add `ltValue` action's tests --- library/src/actions/ltValue/ltValue.test-d.ts | 45 ++ library/src/actions/ltValue/ltValue.test.ts | 656 ++++++++++++++++++ 2 files changed, 701 insertions(+) create mode 100644 library/src/actions/ltValue/ltValue.test-d.ts create mode 100644 library/src/actions/ltValue/ltValue.test.ts diff --git a/library/src/actions/ltValue/ltValue.test-d.ts b/library/src/actions/ltValue/ltValue.test-d.ts new file mode 100644 index 000000000..213bd91f7 --- /dev/null +++ b/library/src/actions/ltValue/ltValue.test-d.ts @@ -0,0 +1,45 @@ +import { describe, expectTypeOf, test } from 'vitest'; +import type { InferInput, InferIssue, InferOutput } from '../../types/index.ts'; +import { ltValue, type LtValueAction, type LtValueIssue } from './ltValue.ts'; + +describe('ltValue', () => { + describe('should return action object', () => { + test('with undefined message', () => { + type Action = LtValueAction; + expectTypeOf(ltValue(10)).toEqualTypeOf(); + expectTypeOf( + ltValue(10, undefined) + ).toEqualTypeOf(); + }); + + test('with string message', () => { + expectTypeOf(ltValue(10, 'message')).toEqualTypeOf< + LtValueAction + >(); + }); + + test('with function message', () => { + expectTypeOf( + ltValue string>(10, () => 'message') + ).toEqualTypeOf string>>(); + }); + }); + + describe('should infer correct types', () => { + type Action = LtValueAction; + + test('of input', () => { + expectTypeOf>().toEqualTypeOf(); + }); + + test('of output', () => { + expectTypeOf>().toEqualTypeOf(); + }); + + test('of issue', () => { + expectTypeOf>().toEqualTypeOf< + LtValueIssue + >(); + }); + }); +}); diff --git a/library/src/actions/ltValue/ltValue.test.ts b/library/src/actions/ltValue/ltValue.test.ts new file mode 100644 index 000000000..fb47c8447 --- /dev/null +++ b/library/src/actions/ltValue/ltValue.test.ts @@ -0,0 +1,656 @@ +import { describe, expect, test } from 'vitest'; +import type { NumberIssue } from '../../schemas/index.ts'; +import { _stringify } from '../../utils/index.ts'; +import { expectActionIssue, expectNoActionIssue } from '../../vitest/index.ts'; +import { ltValue, type LtValueAction } from './ltValue.ts'; + +describe('ltValue', () => { + describe('should return action object', () => { + const baseAction: Omit, 'message'> = { + kind: 'validation', + type: 'lt_value', + reference: ltValue, + expects: '<5', + requirement: 5, + async: false, + '~run': expect.any(Function), + }; + + test('with undefined message', () => { + const action: LtValueAction = { + ...baseAction, + message: undefined, + }; + expect(ltValue(5)).toStrictEqual(action); + expect(ltValue(5, undefined)).toStrictEqual(action); + }); + + test('with string message', () => { + expect(ltValue(5, 'message')).toStrictEqual({ + ...baseAction, + message: 'message', + } satisfies LtValueAction); + }); + + test('with function message', () => { + const message = () => 'message'; + expect(ltValue(5, message)).toStrictEqual({ + ...baseAction, + message, + } satisfies LtValueAction); + }); + }); + + describe('should return dataset without issues', () => { + test('for untyped inputs', () => { + const issues: [NumberIssue] = [ + { + kind: 'schema', + type: 'number', + input: null, + expected: 'number', + received: 'null', + message: 'message', + }, + ]; + expect( + ltValue(1)['~run']({ typed: false, value: null, issues }, {}) + ).toStrictEqual({ typed: false, value: null, issues }); + }); + + test('for valid bigints', () => { + expectNoActionIssue(ltValue(10n), [-9999n, 0n, 9n]); + }); + + test('for valid non-bigints', () => { + expectNoActionIssue(ltValue(10n), [ + '-10', + ' 9 ', + '9', + 9.5, + 9, + 9.0, + -Infinity, + false, + true, + new Date(-10), + new Date(0), + new Date(9), + new Date(9.5), + ]); + + expectNoActionIssue(ltValue(1n), [ + '-1', + ' 0 ', + '0', + -1, + 0.0, + 0, + 0.5, + -Infinity, + false, + new Date(-1), + new Date(0), + new Date(0.5), + ]); + + expectNoActionIssue(ltValue(0n), [ + '-1', + ' -1 ', + -0.5, + -1, + -1.0, + -Infinity, + new Date(-1), + new Date(-1.5), + ]); + }); + + test('for valid booleans', () => { + expectNoActionIssue(ltValue(true), [false]); + }); + + test('for valid non-booleans', () => { + expectNoActionIssue(ltValue(true), [ + '-1', + ' 0 ', + '0', + '0.5', + -1, + 0.0, + 0, + 0.5, + -Infinity, + new Date(-1), + new Date(0), + new Date(0.5), + -1n, + 0n, + ]); + + expectNoActionIssue(ltValue(false), [ + '-1', + ' -1 ', + '-0.5', + -0.5, + -1, + -1.0, + -Infinity, + new Date(-1), + new Date(-1.5), + -1n, + ]); + }); + + test('for valid dates', () => { + const date = new Date(); + expectNoActionIssue(ltValue(date), [ + new Date(0), + new Date(+date - 999999), + new Date(+date - 1), + ]); + }); + + test('for valid non-dates', () => { + const date1 = new Date(10); + expectNoActionIssue(ltValue(date1), [ + '-10', + ' 9 ', + '9', + '9.5', + 9.5, + 9, + 9.0, + -Infinity, + false, + true, + -10n, + 0n, + 9n, + ]); + + const date2 = new Date(1); + expectNoActionIssue(ltValue(date2), [ + '-1', + ' 0 ', + '0', + '0.5', + -1, + 0.0, + 0, + 0.5, + -Infinity, + false, + -1n, + 0n, + ]); + + const date3 = new Date(0); + expectNoActionIssue(ltValue(date3), [ + '-1', + ' -1 ', + '-0.5', + -0.5, + -1, + -1.0, + -Infinity, + -1n, + ]); + }); + + test('for valid numbers', () => { + expectNoActionIssue(ltValue(10), [Number.MIN_VALUE, 0, 9, 9.5]); + }); + + test('for valid non-numbers', () => { + expectNoActionIssue(ltValue(10), [ + '-10', + ' 9 ', + '9', + '9.5', + false, + true, + new Date(-10), + new Date(0), + new Date(9), + new Date(9.5), + -10n, + 0n, + 9n, + ]); + + expectNoActionIssue(ltValue(1), [ + '-1', + ' 0 ', + '0', + '0.5', + false, + new Date(-1), + new Date(0), + new Date(0.5), + -1n, + 0n, + ]); + + expectNoActionIssue(ltValue(0), [ + '-1', + ' -1 ', + '-0.5', + new Date(-1), + new Date(-1.5), + -1n, + ]); + }); + + test('for valid strings', () => { + expectNoActionIssue(ltValue('2024'), ['', '1234', '2023']); + }); + + test('for valid non-strings', () => { + expectNoActionIssue(ltValue('10'), [ + 9.5, + 9, + 9.0, + -Infinity, + false, + true, + new Date(-10), + new Date(0), + new Date(9), + new Date(9.5), + -10n, + 0n, + 9n, + ]); + + expectNoActionIssue(ltValue('1'), [ + -1, + 0, + 0.5, + -Infinity, + false, + new Date(-1), + new Date(0), + new Date(0.5), + -1n, + 0n, + ]); + + expectNoActionIssue(ltValue('0'), [ + -0.5, + -1, + -1.0, + -Infinity, + new Date(-1), + new Date(-1.5), + -1n, + ]); + }); + }); + + describe('should return dataset with issues', () => { + const baseInfo = { + kind: 'validation', + type: 'lt_value', + message: 'message', + } as const; + + const getReceived = (value: unknown): string => + value instanceof Date ? value.toJSON() : _stringify(value); + + test('for invalid bigints', () => { + expectActionIssue( + ltValue(10n, 'message'), + { ...baseInfo, expected: '<10', requirement: 10n }, + [10n, 11n, 9999n] + ); + }); + + test('for invalid non-bigints', () => { + expectActionIssue( + ltValue(123n, 'message'), + { ...baseInfo, expected: '<123', requirement: 123n }, + [ + 'nan', + '122px', + '+ 122', + '122.0', + '123', + '124', + 123, + 124, + 124.0, + Infinity, + NaN, + new Date(123), + new Date(123.5), + new Date(124), + ], + getReceived + ); + + expectActionIssue( + ltValue(1n, 'message'), + { ...baseInfo, expected: '<1', requirement: 1n }, + [ + 'nan', + '0px', + '+ 0', + '0.0', + '1', + 1, + 1.0, + 2, + Infinity, + NaN, + true, + new Date(1), + new Date(2), + ], + getReceived + ); + + expectActionIssue( + ltValue(0n, 'message'), + { ...baseInfo, expected: '<0', requirement: 0n }, + [ + 'nan', + '-1px', + '- 1', + '-1.0', + '0', + 0, + 0.0, + 1, + 1.0, + Infinity, + NaN, + false, + true, + new Date(0), + new Date(0.5), + new Date(1), + ], + getReceived + ); + }); + + test('for invalid booleans', () => { + expectActionIssue( + ltValue(false, 'message'), + { ...baseInfo, expected: ' { + expectActionIssue( + ltValue(false, 'message'), + { ...baseInfo, expected: ' { + const date = new Date(); + expectActionIssue( + ltValue(date, 'message'), + { ...baseInfo, expected: `<${date.toJSON()}`, requirement: date }, + [date, new Date(+date + 1), new Date(+date + 999999)], + (value) => value.toJSON() + ); + }); + + test('for invalid non-dates', () => { + const date1 = new Date(123); + expectActionIssue( + ltValue(date1, 'message'), + { ...baseInfo, expected: `<${date1.toJSON()}`, requirement: date1 }, + [ + 'nan', + '122px', + '+ 122', + '123', + '124.0', + 123, + 124, + 124.0, + Infinity, + NaN, + 123n, + 124n, + ], + getReceived + ); + + const date2 = new Date(1); + expectActionIssue( + ltValue(date2, 'message'), + { ...baseInfo, expected: `<${date2.toJSON()}`, requirement: date2 }, + [ + 'nan', + '0px', + '+ 0', + '1', + '1.0', + 1, + 1.0, + 2, + Infinity, + NaN, + true, + 1n, + 2n, + ], + getReceived + ); + + const date3 = new Date(0); + expectActionIssue( + ltValue(date3, 'message'), + { ...baseInfo, expected: `<${date3.toJSON()}`, requirement: date3 }, + [ + 'nan', + '-1px', + '- 1', + '0', + '0.0', + 0, + 0.0, + 1, + 1.0, + Infinity, + NaN, + false, + true, + 0n, + 1n, + ], + getReceived + ); + }); + + test('for invalid numbers', () => { + expectActionIssue( + ltValue(10, 'message'), + { ...baseInfo, expected: '<10', requirement: 10 }, + [10, 11, 9999, Number.MAX_VALUE, NaN] + ); + }); + + test('for invalid non-numbers', () => { + expectActionIssue( + ltValue(123, 'message'), + { ...baseInfo, expected: '<123', requirement: 123 }, + [ + 'nan', + '122px', + '+ 122', + '123', + '124', + '124.0', + new Date(123), + new Date(123.5), + new Date(124), + 123n, + 124n, + ], + getReceived + ); + + expectActionIssue( + ltValue(1, 'message'), + { ...baseInfo, expected: '<1', requirement: 1 }, + [ + 'nan', + '0px', + '+ 0', + '1', + '1.0', + true, + new Date(1), + new Date(2), + 1n, + 2n, + ], + getReceived + ); + + expectActionIssue( + ltValue(0, 'message'), + { ...baseInfo, expected: '<0', requirement: 0 }, + [ + 'nan', + '-1px', + '- 1', + '0', + '0.0', + false, + true, + new Date(0), + new Date(0.5), + new Date(1), + 0n, + 1n, + ], + getReceived + ); + }); + + test('for invalid strings', () => { + expectActionIssue( + ltValue('2024', 'message'), + { ...baseInfo, expected: '<"2024"', requirement: '2024' }, + ['2024', '2025', '9999', 'XYZ'] + ); + }); + + test('for invalid non-strings', () => { + expectActionIssue( + ltValue('123', 'message'), + { ...baseInfo, expected: '<"123"', requirement: '123' }, + [ + 123, + 124, + 124.0, + Infinity, + NaN, + new Date(123), + new Date(123.5), + new Date(124), + 123n, + 124n, + ], + getReceived + ); + + expectActionIssue( + ltValue('1', 'message'), + { ...baseInfo, expected: '<"1"', requirement: '1' }, + [ + 1, + 1.0, + 2, + Infinity, + NaN, + true, + new Date(1), + new Date(1.5), + new Date(2), + 1n, + 2n, + ], + getReceived + ); + + expectActionIssue( + ltValue('0', 'message'), + { ...baseInfo, expected: '<"0"', requirement: '0' }, + [ + 0, + 0.0, + 1, + 1.0, + Infinity, + NaN, + false, + true, + new Date(0), + new Date(0.5), + new Date(1), + 0n, + 1n, + ], + getReceived + ); + }); + }); +}); From 3f45c271e33995ffb3effe2cbf37b1fd0ce4fc2b Mon Sep 17 00:00:00 2001 From: Elton Lobo Date: Thu, 19 Dec 2024 00:51:45 +0530 Subject: [PATCH 3/5] add `ltValue` action's & related type's API refs --- .../routes/api/(actions)/ltValue/index.mdx | 93 ++++++++++++++ .../api/(actions)/ltValue/properties.ts | 83 ++++++++++++ .../api/(types)/LtValueAction/index.mdx | 28 ++++ .../api/(types)/LtValueAction/properties.ts | 121 ++++++++++++++++++ .../routes/api/(types)/LtValueIssue/index.mdx | 26 ++++ .../api/(types)/LtValueIssue/properties.ts | 63 +++++++++ website/src/routes/api/menu.md | 3 + 7 files changed, 417 insertions(+) create mode 100644 website/src/routes/api/(actions)/ltValue/index.mdx create mode 100644 website/src/routes/api/(actions)/ltValue/properties.ts create mode 100644 website/src/routes/api/(types)/LtValueAction/index.mdx create mode 100644 website/src/routes/api/(types)/LtValueAction/properties.ts create mode 100644 website/src/routes/api/(types)/LtValueIssue/index.mdx create mode 100644 website/src/routes/api/(types)/LtValueIssue/properties.ts diff --git a/website/src/routes/api/(actions)/ltValue/index.mdx b/website/src/routes/api/(actions)/ltValue/index.mdx new file mode 100644 index 000000000..18d29d351 --- /dev/null +++ b/website/src/routes/api/(actions)/ltValue/index.mdx @@ -0,0 +1,93 @@ +--- +title: ltValue +description: Creates a less than value validation action. +source: /actions/ltValue/ltValue.ts +contributors: + - EltonLobo07 +--- + +import { ApiList, Property } from '~/components'; +import { properties } from './properties'; + +# ltValue + +Creates a less than value validation action. + +```ts +const Action = v.ltValue(requirement, message); +``` + +## Generics + +- `TInput` +- `TRequirement` +- `TMessage` + +## Parameters + +- `requirement` +- `message` + +### Explanation + +With `ltValue` you can validate the value of a string, number, boolean or date. If the input does not match the `requirement`, you can use `message` to customize the error message. + +## Returns + +- `Action` + +## Examples + +The following examples show how `ltValue` can be used. + +### Number schema + +Schema to validate a number with a less than value. + +```ts +const NumberSchema = v.pipe( + v.number(), + v.ltValue(100, 'The number must be less than 100.') +); +``` + +### Date schema + +Schema to validate a date with a less than value. + +```ts +const DateSchema = v.pipe( + v.date(), + v.ltValue( + new Date('2000-01-01'), + 'The date must be less than 1st January 2000.' + ) +); +``` + +## Related + +The following APIs can be combined with `ltValue`. + +### Schemas + + + +### Methods + + + +### Utils + + diff --git a/website/src/routes/api/(actions)/ltValue/properties.ts b/website/src/routes/api/(actions)/ltValue/properties.ts new file mode 100644 index 000000000..78cad9d3e --- /dev/null +++ b/website/src/routes/api/(actions)/ltValue/properties.ts @@ -0,0 +1,83 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + TInput: { + modifier: 'extends', + type: { + type: 'custom', + name: 'ValueInput', + href: '../ValueInput/', + }, + }, + TRequirement: { + modifier: 'extends', + type: { + type: 'custom', + name: 'TInput', + }, + }, + TMessage: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'ErrorMessage', + href: '../ErrorMessage/', + generics: [ + { + type: 'custom', + name: 'LtValueIssue', + href: '../LtValueIssue/', + generics: [ + { + type: 'custom', + name: 'TInput', + }, + { + type: 'custom', + name: 'TRequirement', + }, + ], + }, + ], + }, + 'undefined', + ], + }, + }, + requirement: { + type: { + type: 'custom', + name: 'TRequirement', + }, + }, + message: { + type: { + type: 'custom', + name: 'TMessage', + }, + }, + Action: { + type: { + type: 'custom', + name: 'LtValueAction', + href: '../LtValueAction/', + generics: [ + { + type: 'custom', + name: 'TInput', + }, + { + type: 'custom', + name: 'TRequirement', + }, + { + type: 'custom', + name: 'TMessage', + }, + ], + }, + }, +}; diff --git a/website/src/routes/api/(types)/LtValueAction/index.mdx b/website/src/routes/api/(types)/LtValueAction/index.mdx new file mode 100644 index 000000000..20f5518ae --- /dev/null +++ b/website/src/routes/api/(types)/LtValueAction/index.mdx @@ -0,0 +1,28 @@ +--- +title: LtValueAction +description: Less than value action type. +contributors: + - EltonLobo07 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# LtValueAction + +Less than value action type. + +## Generics + +- `TInput` +- `TRequirement` +- `TMessage` + +## Definition + +- `LtValueAction` + - `type` + - `reference` + - `expects` + - `requirement` + - `message` diff --git a/website/src/routes/api/(types)/LtValueAction/properties.ts b/website/src/routes/api/(types)/LtValueAction/properties.ts new file mode 100644 index 000000000..56975b6ba --- /dev/null +++ b/website/src/routes/api/(types)/LtValueAction/properties.ts @@ -0,0 +1,121 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + TInput: { + modifier: 'extends', + type: { + type: 'custom', + name: 'ValueInput', + href: '../ValueInput/', + }, + }, + TRequirement: { + modifier: 'extends', + type: { + type: 'custom', + name: 'TInput', + }, + }, + TMessage: { + modifier: 'extends', + type: { + type: 'union', + options: [ + { + type: 'custom', + name: 'ErrorMessage', + href: '../ErrorMessage/', + generics: [ + { + type: 'custom', + name: 'LtValueIssue', + href: '../LtValueIssue/', + generics: [ + { + type: 'custom', + name: 'TInput', + }, + { + type: 'custom', + name: 'TRequirement', + }, + ], + }, + ], + }, + 'undefined', + ], + }, + }, + BaseValidation: { + modifier: 'extends', + type: { + type: 'custom', + name: 'BaseValidation', + href: '../BaseValidation/', + generics: [ + { + type: 'custom', + name: 'TInput', + }, + { + type: 'custom', + name: 'TInput', + }, + { + type: 'custom', + name: 'LtValueIssue', + href: '../LtValueIssue/', + generics: [ + { + type: 'custom', + name: 'TInput', + }, + { + type: 'custom', + name: 'TRequirement', + }, + ], + }, + ], + }, + }, + type: { + type: { + type: 'string', + value: 'lt_value', + }, + }, + reference: { + type: { + type: 'custom', + modifier: 'typeof', + name: 'ltValue', + href: '../ltValue/', + }, + }, + expects: { + type: { + type: 'template', + parts: [ + { + type: 'string', + value: '<', + }, + 'string', + ], + }, + }, + requirement: { + type: { + type: 'custom', + name: 'TRequirement', + }, + }, + message: { + type: { + type: 'custom', + name: 'TMessage', + }, + }, +}; diff --git a/website/src/routes/api/(types)/LtValueIssue/index.mdx b/website/src/routes/api/(types)/LtValueIssue/index.mdx new file mode 100644 index 000000000..dca8f4629 --- /dev/null +++ b/website/src/routes/api/(types)/LtValueIssue/index.mdx @@ -0,0 +1,26 @@ +--- +title: LtValueIssue +description: Less than value issue type. +contributors: + - EltonLobo07 +--- + +import { Property } from '~/components'; +import { properties } from './properties'; + +# LtValueIssue + +Less than value issue type. + +## Generics + +- `TInput` +- `TRequirement` + +## Definition + +- `LtValueIssue` + - `kind` + - `type` + - `expected` + - `requirement` diff --git a/website/src/routes/api/(types)/LtValueIssue/properties.ts b/website/src/routes/api/(types)/LtValueIssue/properties.ts new file mode 100644 index 000000000..f5c7fa1e0 --- /dev/null +++ b/website/src/routes/api/(types)/LtValueIssue/properties.ts @@ -0,0 +1,63 @@ +import type { PropertyProps } from '~/components'; + +export const properties: Record = { + TInput: { + modifier: 'extends', + type: { + type: 'custom', + name: 'ValueInput', + href: '../ValueInput/', + }, + }, + TRequirement: { + modifier: 'extends', + type: { + type: 'custom', + name: 'TInput', + }, + }, + BaseIssue: { + modifier: 'extends', + type: { + type: 'custom', + name: 'BaseIssue', + href: '../BaseIssue/', + generics: [ + { + type: 'custom', + name: 'TInput', + }, + ], + }, + }, + kind: { + type: { + type: 'string', + value: 'validation', + }, + }, + type: { + type: { + type: 'string', + value: 'lt_value', + }, + }, + expected: { + type: { + type: 'template', + parts: [ + { + type: 'string', + value: '<', + }, + 'string', + ], + }, + }, + requirement: { + type: { + type: 'custom', + name: 'TRequirement', + }, + }, +}; diff --git a/website/src/routes/api/menu.md b/website/src/routes/api/menu.md index c2de16d74..8526c5da2 100644 --- a/website/src/routes/api/menu.md +++ b/website/src/routes/api/menu.md @@ -112,6 +112,7 @@ - [isoTimestamp](/api/isoTimestamp/) - [isoWeek](/api/isoWeek/) - [length](/api/length/) +- [ltValue](/api/ltValue) - [mac](/api/mac/) - [mac48](/api/mac48/) - [mac64](/api/mac64/) @@ -430,6 +431,8 @@ - [LooseTupleSchema](/api/LooseTupleSchema/) - [LooseTupleSchemaAsync](/api/LooseTupleSchemaAsync/) - [LiteralSchema](/api/LiteralSchema/) +- [LtValueAction](/api/LtValueAction/) +- [LtValueIssue](/api/LtValueIssue/) - [Mac48Action](/api/Mac48Action/) - [Mac48Issue](/api/Mac48Issue/) - [Mac64Action](/api/Mac64Action/) From 064262e9adf626e38c51eea51bf8471e0a7b4d7a Mon Sep 17 00:00:00 2001 From: Elton Lobo Date: Thu, 19 Dec 2024 00:52:36 +0530 Subject: [PATCH 4/5] update website to include `ltValue` wherever necessary --- website/src/routes/api/(async)/customAsync/index.mdx | 1 + website/src/routes/api/(async)/fallbackAsync/index.mdx | 1 + website/src/routes/api/(async)/intersectAsync/index.mdx | 1 + website/src/routes/api/(async)/lazyAsync/index.mdx | 1 + website/src/routes/api/(async)/pipeAsync/index.mdx | 1 + website/src/routes/api/(async)/unionAsync/index.mdx | 1 + website/src/routes/api/(methods)/config/index.mdx | 2 ++ website/src/routes/api/(methods)/fallback/index.mdx | 2 ++ website/src/routes/api/(methods)/pipe/index.mdx | 2 ++ website/src/routes/api/(schemas)/any/index.mdx | 2 ++ website/src/routes/api/(schemas)/bigint/index.mdx | 2 ++ website/src/routes/api/(schemas)/boolean/index.mdx | 2 ++ website/src/routes/api/(schemas)/custom/index.mdx | 2 ++ website/src/routes/api/(schemas)/date/index.mdx | 2 ++ website/src/routes/api/(schemas)/instance/index.mdx | 2 ++ website/src/routes/api/(schemas)/intersect/index.mdx | 1 + website/src/routes/api/(schemas)/lazy/index.mdx | 1 + website/src/routes/api/(schemas)/number/index.mdx | 2 ++ website/src/routes/api/(schemas)/string/index.mdx | 2 ++ website/src/routes/api/(schemas)/union/index.mdx | 2 ++ website/src/routes/api/(schemas)/unknown/index.mdx | 2 ++ website/src/routes/guides/(main-concepts)/pipelines/index.mdx | 1 + .../src/routes/guides/(migration)/migrate-from-zod/index.mdx | 3 ++- 23 files changed, 37 insertions(+), 1 deletion(-) diff --git a/website/src/routes/api/(async)/customAsync/index.mdx b/website/src/routes/api/(async)/customAsync/index.mdx index 67656d11c..029c24127 100644 --- a/website/src/routes/api/(async)/customAsync/index.mdx +++ b/website/src/routes/api/(async)/customAsync/index.mdx @@ -143,6 +143,7 @@ The following APIs can be combined with `customAsync`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(async)/fallbackAsync/index.mdx b/website/src/routes/api/(async)/fallbackAsync/index.mdx index b915001d2..fd6f5095d 100644 --- a/website/src/routes/api/(async)/fallbackAsync/index.mdx +++ b/website/src/routes/api/(async)/fallbackAsync/index.mdx @@ -171,6 +171,7 @@ The following APIs can be combined with `fallbackAsync`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(async)/intersectAsync/index.mdx b/website/src/routes/api/(async)/intersectAsync/index.mdx index 622dcda9b..a660dafa4 100644 --- a/website/src/routes/api/(async)/intersectAsync/index.mdx +++ b/website/src/routes/api/(async)/intersectAsync/index.mdx @@ -174,6 +174,7 @@ The following APIs can be combined with `intersectAsync`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(async)/lazyAsync/index.mdx b/website/src/routes/api/(async)/lazyAsync/index.mdx index f1f550abf..a4001ef1d 100644 --- a/website/src/routes/api/(async)/lazyAsync/index.mdx +++ b/website/src/routes/api/(async)/lazyAsync/index.mdx @@ -206,6 +206,7 @@ The following APIs can be combined with `lazyAsync`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(async)/pipeAsync/index.mdx b/website/src/routes/api/(async)/pipeAsync/index.mdx index 9fde57db7..29a8add5c 100644 --- a/website/src/routes/api/(async)/pipeAsync/index.mdx +++ b/website/src/routes/api/(async)/pipeAsync/index.mdx @@ -210,6 +210,7 @@ The following APIs can be combined with `pipeAsync`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(async)/unionAsync/index.mdx b/website/src/routes/api/(async)/unionAsync/index.mdx index ee85bdf6b..3c90b6c12 100644 --- a/website/src/routes/api/(async)/unionAsync/index.mdx +++ b/website/src/routes/api/(async)/unionAsync/index.mdx @@ -167,6 +167,7 @@ The following APIs can be combined with `unionAsync`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(methods)/config/index.mdx b/website/src/routes/api/(methods)/config/index.mdx index d437fee1b..1f1470fc5 100644 --- a/website/src/routes/api/(methods)/config/index.mdx +++ b/website/src/routes/api/(methods)/config/index.mdx @@ -4,6 +4,7 @@ description: Changes the local configuration of a schema. source: /methods/config/config.ts contributors: - fabian-hiller + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -188,6 +189,7 @@ The following APIs can be combined with `config`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(methods)/fallback/index.mdx b/website/src/routes/api/(methods)/fallback/index.mdx index 993662d4a..069b4ff18 100644 --- a/website/src/routes/api/(methods)/fallback/index.mdx +++ b/website/src/routes/api/(methods)/fallback/index.mdx @@ -7,6 +7,7 @@ contributors: - morinokami - sqmasep - FlorianDevPhynix + - EltonLobo07 --- import { Link } from '@builder.io/qwik-city'; @@ -187,6 +188,7 @@ The following APIs can be combined with `fallback`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(methods)/pipe/index.mdx b/website/src/routes/api/(methods)/pipe/index.mdx index 4310851e1..071fb5a0a 100644 --- a/website/src/routes/api/(methods)/pipe/index.mdx +++ b/website/src/routes/api/(methods)/pipe/index.mdx @@ -7,6 +7,7 @@ contributors: - fabian-hiller - morinokami - jasperteo + - EltonLobo07 --- import { Link } from '@builder.io/qwik-city'; @@ -191,6 +192,7 @@ The following APIs can be combined with `pipe`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(schemas)/any/index.mdx b/website/src/routes/api/(schemas)/any/index.mdx index 27af7568b..ffb8749bb 100644 --- a/website/src/routes/api/(schemas)/any/index.mdx +++ b/website/src/routes/api/(schemas)/any/index.mdx @@ -6,6 +6,7 @@ contributors: - fabian-hiller - morinokami - jasperteo + - EltonLobo07 --- import { Link } from '@builder.io/qwik-city'; @@ -120,6 +121,7 @@ The following APIs can be combined with `any`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(schemas)/bigint/index.mdx b/website/src/routes/api/(schemas)/bigint/index.mdx index 695327ac9..4e2448376 100644 --- a/website/src/routes/api/(schemas)/bigint/index.mdx +++ b/website/src/routes/api/(schemas)/bigint/index.mdx @@ -4,6 +4,7 @@ description: Creates a bigint schema. source: /schemas/bigint/bigint.ts contributors: - fabian-hiller + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -113,6 +114,7 @@ The following APIs can be combined with `bigint`. 'check', 'brand', 'description', + 'ltValue', 'maxValue', 'metadata', 'minValue', diff --git a/website/src/routes/api/(schemas)/boolean/index.mdx b/website/src/routes/api/(schemas)/boolean/index.mdx index 93c3e5fd4..c21b3fad6 100644 --- a/website/src/routes/api/(schemas)/boolean/index.mdx +++ b/website/src/routes/api/(schemas)/boolean/index.mdx @@ -5,6 +5,7 @@ source: /schemas/boolean/boolean.ts contributors: - fabian-hiller - wout-junius + - EltonLobo07 --- import { Link } from '@builder.io/qwik-city'; @@ -109,6 +110,7 @@ The following APIs can be combined with `boolean`. 'check', 'brand', 'description', + 'ltValue', 'maxValue', 'maxWords', 'metadata', diff --git a/website/src/routes/api/(schemas)/custom/index.mdx b/website/src/routes/api/(schemas)/custom/index.mdx index 55545e3f8..5cf098334 100644 --- a/website/src/routes/api/(schemas)/custom/index.mdx +++ b/website/src/routes/api/(schemas)/custom/index.mdx @@ -5,6 +5,7 @@ source: /schemas/custom/custom.ts contributors: - fabian-hiller - morinokami + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -148,6 +149,7 @@ The following APIs can be combined with `custom`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(schemas)/date/index.mdx b/website/src/routes/api/(schemas)/date/index.mdx index 332ce19c4..53a807dbe 100644 --- a/website/src/routes/api/(schemas)/date/index.mdx +++ b/website/src/routes/api/(schemas)/date/index.mdx @@ -5,6 +5,7 @@ source: /schemas/date/date.ts contributors: - fabian-hiller - wout-junius + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -118,6 +119,7 @@ The following APIs can be combined with `date`. 'check', 'brand', 'description', + 'ltValue', 'maxValue', 'metadata', 'minValue', diff --git a/website/src/routes/api/(schemas)/instance/index.mdx b/website/src/routes/api/(schemas)/instance/index.mdx index ebc1c6ac6..e0331a089 100644 --- a/website/src/routes/api/(schemas)/instance/index.mdx +++ b/website/src/routes/api/(schemas)/instance/index.mdx @@ -4,6 +4,7 @@ description: Creates an instance schema. source: /schemas/instance/instance.ts contributors: - fabian-hiller + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -119,6 +120,7 @@ The following APIs can be combined with `instance`. 'check', 'brand', 'description', + 'ltValue', 'maxSize', 'maxValue', 'metadata', diff --git a/website/src/routes/api/(schemas)/intersect/index.mdx b/website/src/routes/api/(schemas)/intersect/index.mdx index 585a0496e..cb84be5dc 100644 --- a/website/src/routes/api/(schemas)/intersect/index.mdx +++ b/website/src/routes/api/(schemas)/intersect/index.mdx @@ -171,6 +171,7 @@ The following APIs can be combined with `intersect`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(schemas)/lazy/index.mdx b/website/src/routes/api/(schemas)/lazy/index.mdx index 6d5558820..b2f115d7f 100644 --- a/website/src/routes/api/(schemas)/lazy/index.mdx +++ b/website/src/routes/api/(schemas)/lazy/index.mdx @@ -207,6 +207,7 @@ The following APIs can be combined with `lazy`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(schemas)/number/index.mdx b/website/src/routes/api/(schemas)/number/index.mdx index 817a1d8fc..432e6e40e 100644 --- a/website/src/routes/api/(schemas)/number/index.mdx +++ b/website/src/routes/api/(schemas)/number/index.mdx @@ -4,6 +4,7 @@ source: /schemas/number/number.ts contributors: - fabian-hiller - kazizi55 + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -123,6 +124,7 @@ The following APIs can be combined with `number`. 'description', 'finite', 'integer', + 'ltValue', 'maxValue', 'metadata', 'minValue', diff --git a/website/src/routes/api/(schemas)/string/index.mdx b/website/src/routes/api/(schemas)/string/index.mdx index 4d8c48421..a2fce8d34 100644 --- a/website/src/routes/api/(schemas)/string/index.mdx +++ b/website/src/routes/api/(schemas)/string/index.mdx @@ -7,6 +7,7 @@ contributors: - morinokami - jasperteo - kazizi55 + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -167,6 +168,7 @@ The following APIs can be combined with `string`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(schemas)/union/index.mdx b/website/src/routes/api/(schemas)/union/index.mdx index 1530497af..e712d5218 100644 --- a/website/src/routes/api/(schemas)/union/index.mdx +++ b/website/src/routes/api/(schemas)/union/index.mdx @@ -6,6 +6,7 @@ contributors: - fabian-hiller - morinokami - thundermiracle + - EltonLobo07 --- import { Link } from '@builder.io/qwik-city'; @@ -187,6 +188,7 @@ The following APIs can be combined with `union`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/api/(schemas)/unknown/index.mdx b/website/src/routes/api/(schemas)/unknown/index.mdx index e35dda79f..87c3884d2 100644 --- a/website/src/routes/api/(schemas)/unknown/index.mdx +++ b/website/src/routes/api/(schemas)/unknown/index.mdx @@ -7,6 +7,7 @@ contributors: - morinokami - mwskwong - jasperteo + - EltonLobo07 --- import { ApiList, Property } from '~/components'; @@ -120,6 +121,7 @@ The following APIs can be combined with `unknown`. 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/guides/(main-concepts)/pipelines/index.mdx b/website/src/routes/guides/(main-concepts)/pipelines/index.mdx index 792416f78..ddc7662c1 100644 --- a/website/src/routes/guides/(main-concepts)/pipelines/index.mdx +++ b/website/src/routes/guides/(main-concepts)/pipelines/index.mdx @@ -80,6 +80,7 @@ Pipeline validation actions examine the input and, if the input does not meet a 'isoTimestamp', 'isoWeek', 'length', + 'ltValue', 'mac', 'mac48', 'mac64', diff --git a/website/src/routes/guides/(migration)/migrate-from-zod/index.mdx b/website/src/routes/guides/(migration)/migrate-from-zod/index.mdx index eae58eefb..3be8f4265 100644 --- a/website/src/routes/guides/(migration)/migrate-from-zod/index.mdx +++ b/website/src/routes/guides/(migration)/migrate-from-zod/index.mdx @@ -77,7 +77,8 @@ Most of the names are the same as in Zod. However, there are some exceptions. Th | `input` | `InferInput` | | `instanceof` | `instance` | | `intersection` | `intersect` | -| `lt`, `lte` | `maxValue` | +| `lt` | `ltValue` | +| `lte` | `maxValue` | | `max` | `maxLength`, `maxSize`, `maxValue` | | `min` | `minLength`, `minSize`, `minValue` | | `nativeEnum` | `enum` | From 6610cf4a124e84054bac615f171b49ed27de89b5 Mon Sep 17 00:00:00 2001 From: Fabian Hiller Date: Sun, 16 Feb 2025 12:06:24 -0500 Subject: [PATCH 5/5] Add tree shaking comment to ltValue and improve tests slightly --- library/CHANGELOG.md | 1 + library/src/actions/ltValue/ltValue.test.ts | 57 ++++++++------------- library/src/actions/ltValue/ltValue.ts | 1 + 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/library/CHANGELOG.md b/library/CHANGELOG.md index c87c371bb..7ca3789d2 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 `rfcEmail` action to validate RFC 5322 email addresses (pull request #912) +- Add `ltValue` action for less than validation (pull request #985) - 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) - Add `exactOptional` and `exactOptionalAsync` schema (PR #1013) diff --git a/library/src/actions/ltValue/ltValue.test.ts b/library/src/actions/ltValue/ltValue.test.ts index fb47c8447..e28513a80 100644 --- a/library/src/actions/ltValue/ltValue.test.ts +++ b/library/src/actions/ltValue/ltValue.test.ts @@ -65,22 +65,30 @@ describe('ltValue', () => { test('for valid non-bigints', () => { expectNoActionIssue(ltValue(10n), [ '-10', - ' 9 ', + '', + ' ', + '0', '9', - 9.5, + ' 9 ', + -10, + 0, 9, - 9.0, -Infinity, + -10.0, + 0.0, + 9.0, + 9.5, false, true, new Date(-10), new Date(0), new Date(9), - new Date(9.5), ]); expectNoActionIssue(ltValue(1n), [ '-1', + '', + ' ', ' 0 ', '0', -1, @@ -91,7 +99,6 @@ describe('ltValue', () => { false, new Date(-1), new Date(0), - new Date(0.5), ]); expectNoActionIssue(ltValue(0n), [ @@ -102,7 +109,6 @@ describe('ltValue', () => { -1.0, -Infinity, new Date(-1), - new Date(-1.5), ]); }); @@ -123,7 +129,6 @@ describe('ltValue', () => { -Infinity, new Date(-1), new Date(0), - new Date(0.5), -1n, 0n, ]); @@ -137,7 +142,6 @@ describe('ltValue', () => { -1.0, -Infinity, new Date(-1), - new Date(-1.5), -1n, ]); }); @@ -172,6 +176,8 @@ describe('ltValue', () => { const date2 = new Date(1); expectNoActionIssue(ltValue(date2), [ '-1', + '', + ' ', ' 0 ', '0', '0.5', @@ -208,12 +214,13 @@ describe('ltValue', () => { ' 9 ', '9', '9.5', + '', + ' ', false, true, new Date(-10), new Date(0), new Date(9), - new Date(9.5), -10n, 0n, 9n, @@ -224,10 +231,11 @@ describe('ltValue', () => { ' 0 ', '0', '0.5', + '', + ' ', false, new Date(-1), new Date(0), - new Date(0.5), -1n, 0n, ]); @@ -237,7 +245,6 @@ describe('ltValue', () => { ' -1 ', '-0.5', new Date(-1), - new Date(-1.5), -1n, ]); }); @@ -248,6 +255,8 @@ describe('ltValue', () => { test('for valid non-strings', () => { expectNoActionIssue(ltValue('10'), [ + -10, + 0, 9.5, 9, 9.0, @@ -257,7 +266,6 @@ describe('ltValue', () => { new Date(-10), new Date(0), new Date(9), - new Date(9.5), -10n, 0n, 9n, @@ -271,7 +279,6 @@ describe('ltValue', () => { false, new Date(-1), new Date(0), - new Date(0.5), -1n, 0n, ]); @@ -282,7 +289,6 @@ describe('ltValue', () => { -1.0, -Infinity, new Date(-1), - new Date(-1.5), -1n, ]); }); @@ -323,7 +329,6 @@ describe('ltValue', () => { Infinity, NaN, new Date(123), - new Date(123.5), new Date(124), ], getReceived @@ -368,7 +373,6 @@ describe('ltValue', () => { false, true, new Date(0), - new Date(0.5), new Date(1), ], getReceived @@ -405,9 +409,7 @@ describe('ltValue', () => { 1.0, Infinity, NaN, - new Date(-0.5), new Date(0), - new Date(0.5), new Date(1), 0n, 1n, @@ -430,7 +432,6 @@ describe('ltValue', () => { Infinity, NaN, new Date(1), - new Date(1.5), new Date(2), 1n, 2n, @@ -538,7 +539,6 @@ describe('ltValue', () => { '124', '124.0', new Date(123), - new Date(123.5), new Date(124), 123n, 124n, @@ -576,7 +576,6 @@ describe('ltValue', () => { false, true, new Date(0), - new Date(0.5), new Date(1), 0n, 1n, @@ -604,7 +603,6 @@ describe('ltValue', () => { Infinity, NaN, new Date(123), - new Date(123.5), new Date(124), 123n, 124n, @@ -615,19 +613,7 @@ describe('ltValue', () => { expectActionIssue( ltValue('1', 'message'), { ...baseInfo, expected: '<"1"', requirement: '1' }, - [ - 1, - 1.0, - 2, - Infinity, - NaN, - true, - new Date(1), - new Date(1.5), - new Date(2), - 1n, - 2n, - ], + [1, 1.0, 2, Infinity, NaN, true, new Date(1), new Date(2), 1n, 2n], getReceived ); @@ -644,7 +630,6 @@ describe('ltValue', () => { false, true, new Date(0), - new Date(0.5), new Date(1), 0n, 1n, diff --git a/library/src/actions/ltValue/ltValue.ts b/library/src/actions/ltValue/ltValue.ts index 6ec92f055..d83f4f80f 100644 --- a/library/src/actions/ltValue/ltValue.ts +++ b/library/src/actions/ltValue/ltValue.ts @@ -92,6 +92,7 @@ export function ltValue< message: TMessage ): LtValueAction; +// @__NO_SIDE_EFFECTS__ export function ltValue( requirement: ValueInput, message?: ErrorMessage>