diff --git a/library/CHANGELOG.md b/library/CHANGELOG.md index f6e0621b4..84a91459a 100644 --- a/library/CHANGELOG.md +++ b/library/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to the library will be documented in this file. - Add `bic` validation function (pull request #284) - Add `mac`, `mac48` and `mac64` validation function (pull request #270) - Change `IntersectOptions`, `IntersectOptionsAsync`, `UnionOptions` and `UnionOptionsAsync` type to support readonly tuples (issue #279) +- Change `PicklistOptions`, `UnionOptions` and `UnionOptionsAsync` type from tuple to array (issue #279) - Fix optional keys of `ObjectInput` and `ObjectOutput` type (issue #242) ## v0.22.0 (December 03, 2023) diff --git a/library/src/schemas/picklist/picklist.ts b/library/src/schemas/picklist/picklist.ts index 22277e02e..c42ddacdc 100644 --- a/library/src/schemas/picklist/picklist.ts +++ b/library/src/schemas/picklist/picklist.ts @@ -49,7 +49,7 @@ export function picklist< return schemaIssue(info, 'type', 'picklist', this.message, input); } - // Return inpot as output + // Return input as output return parseResult(true, input as TOptions[number]); }, }; diff --git a/library/src/schemas/picklist/picklistAsync.ts b/library/src/schemas/picklist/picklistAsync.ts index ca23f0919..b8570ce27 100644 --- a/library/src/schemas/picklist/picklistAsync.ts +++ b/library/src/schemas/picklist/picklistAsync.ts @@ -49,7 +49,7 @@ export function picklistAsync< return schemaIssue(info, 'type', 'picklist', this.message, input); } - // Return inpot as output + // Return input as output return parseResult(true, input as TOptions[number]); }, }; diff --git a/library/src/schemas/picklist/types.ts b/library/src/schemas/picklist/types.ts index 067b0fa58..b602bf37a 100644 --- a/library/src/schemas/picklist/types.ts +++ b/library/src/schemas/picklist/types.ts @@ -4,5 +4,5 @@ import type { MaybeReadonly } from '../../types/index.ts'; * Picklist options type. */ export type PicklistOptions<TOption extends string = string> = MaybeReadonly< - [TOption, ...TOption[]] + TOption[] >; diff --git a/library/src/schemas/union/union.ts b/library/src/schemas/union/union.ts index e31a09d74..dd91fae08 100644 --- a/library/src/schemas/union/union.ts +++ b/library/src/schemas/union/union.ts @@ -11,9 +11,7 @@ import { parseResult, schemaIssue } from '../../utils/index.ts'; /** * Union options type. */ -export type UnionOptions = MaybeReadonly< - [BaseSchema, BaseSchema, ...BaseSchema[]] ->; +export type UnionOptions = MaybeReadonly<BaseSchema[]>; /** * Union schema type. diff --git a/library/src/schemas/union/unionAsync.ts b/library/src/schemas/union/unionAsync.ts index d608cec7a..a15c7095f 100644 --- a/library/src/schemas/union/unionAsync.ts +++ b/library/src/schemas/union/unionAsync.ts @@ -12,13 +12,7 @@ import { parseResult, schemaIssue } from '../../utils/index.ts'; /** * Union options async type. */ -export type UnionOptionsAsync = MaybeReadonly< - [ - BaseSchema | BaseSchemaAsync, - BaseSchema | BaseSchemaAsync, - ...(BaseSchema[] | BaseSchemaAsync[]) - ] ->; +export type UnionOptionsAsync = MaybeReadonly<(BaseSchema | BaseSchemaAsync)[]>; /** * Union schema async type.