From cfc2c2bc87359270aa8dd175cfe58b6e65bc042e Mon Sep 17 00:00:00 2001 From: Vladimir Kutepov Date: Wed, 8 Jan 2025 22:47:17 +0700 Subject: [PATCH 1/2] docs: improve nullable/nullish type definitions --- library/src/schemas/nullable/nullable.ts | 6 ++++-- library/src/schemas/nullable/nullableAsync.ts | 6 ++++-- library/src/schemas/nullish/nullish.ts | 6 ++++-- library/src/schemas/nullish/nullishAsync.ts | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/library/src/schemas/nullable/nullable.ts b/library/src/schemas/nullable/nullable.ts index a8e775bb8..3896f2a75 100644 --- a/library/src/schemas/nullable/nullable.ts +++ b/library/src/schemas/nullable/nullable.ts @@ -44,7 +44,8 @@ export interface NullableSchema< } /** - * Creates a nullable schema. + * Creates a nullable schema that allows null values but not undefined. + * Type: T | null * * @param wrapped The wrapped schema. * @@ -55,7 +56,8 @@ export function nullable< >(wrapped: TWrapped): NullableSchema; /** - * Creates a nullable schema. + * Creates a nullable schema that allows null values but not undefined. + * Type: T | null * * @param wrapped The wrapped schema. * @param default_ The default value. diff --git a/library/src/schemas/nullable/nullableAsync.ts b/library/src/schemas/nullable/nullableAsync.ts index dbd95a7fb..804ce5297 100644 --- a/library/src/schemas/nullable/nullableAsync.ts +++ b/library/src/schemas/nullable/nullableAsync.ts @@ -47,7 +47,8 @@ export interface NullableSchemaAsync< } /** - * Creates a nullable schema. + * Creates a nullable schema that allows null values but not undefined. + * Type: T | null * * @param wrapped The wrapped schema. * @@ -60,7 +61,8 @@ export function nullableAsync< >(wrapped: TWrapped): NullableSchemaAsync; /** - * Creates a nullable schema. + * Creates a nullable schema that allows null values but not undefined. + * Type: T | null * * @param wrapped The wrapped schema. * @param default_ The default value. diff --git a/library/src/schemas/nullish/nullish.ts b/library/src/schemas/nullish/nullish.ts index 085abe669..f3790a0d7 100644 --- a/library/src/schemas/nullish/nullish.ts +++ b/library/src/schemas/nullish/nullish.ts @@ -44,7 +44,8 @@ export interface NullishSchema< } /** - * Creates a nullish schema. + * Creates a nullish schema that allows both null and undefined values. + * Type: T | null | undefined * * @param wrapped The wrapped schema. * @@ -55,7 +56,8 @@ export function nullish< >(wrapped: TWrapped): NullishSchema; /** - * Creates a nullish schema. + * Creates a nullish schema that allows both null and undefined values. + * Type: T | null | undefined * * @param wrapped The wrapped schema. * @param default_ The default value. diff --git a/library/src/schemas/nullish/nullishAsync.ts b/library/src/schemas/nullish/nullishAsync.ts index d49a2dbdc..c587e0bc1 100644 --- a/library/src/schemas/nullish/nullishAsync.ts +++ b/library/src/schemas/nullish/nullishAsync.ts @@ -47,7 +47,8 @@ export interface NullishSchemaAsync< } /** - * Creates a nullish schema. + * Creates a nullish schema that allows both null and undefined values. + * Type: T | null | undefined * * @param wrapped The wrapped schema. * @@ -60,7 +61,8 @@ export function nullishAsync< >(wrapped: TWrapped): NullishSchemaAsync; /** - * Creates a nullish schema. + * Creates a nullish schema that allows both null and undefined values. + * Type: T | null | undefined * * @param wrapped The wrapped schema. * @param default_ The default value. From 30e1df5977826a694065353dcd91b37420356c8f Mon Sep 17 00:00:00 2001 From: Vladimir Kutepov Date: Thu, 9 Jan 2025 13:51:26 +0700 Subject: [PATCH 2/2] Drop "Type: T" comments --- library/src/schemas/nullable/nullable.ts | 6 ++---- library/src/schemas/nullable/nullableAsync.ts | 6 ++---- library/src/schemas/nullish/nullish.ts | 6 ++---- library/src/schemas/nullish/nullishAsync.ts | 6 ++---- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/library/src/schemas/nullable/nullable.ts b/library/src/schemas/nullable/nullable.ts index 3896f2a75..1d4cef837 100644 --- a/library/src/schemas/nullable/nullable.ts +++ b/library/src/schemas/nullable/nullable.ts @@ -44,8 +44,7 @@ export interface NullableSchema< } /** - * Creates a nullable schema that allows null values but not undefined. - * Type: T | null + * Creates a nullable schema that allows null values. * * @param wrapped The wrapped schema. * @@ -56,8 +55,7 @@ export function nullable< >(wrapped: TWrapped): NullableSchema; /** - * Creates a nullable schema that allows null values but not undefined. - * Type: T | null + * Creates a nullable schema that allows null values. * * @param wrapped The wrapped schema. * @param default_ The default value. diff --git a/library/src/schemas/nullable/nullableAsync.ts b/library/src/schemas/nullable/nullableAsync.ts index 804ce5297..f5c79f67d 100644 --- a/library/src/schemas/nullable/nullableAsync.ts +++ b/library/src/schemas/nullable/nullableAsync.ts @@ -47,8 +47,7 @@ export interface NullableSchemaAsync< } /** - * Creates a nullable schema that allows null values but not undefined. - * Type: T | null + * Creates a nullable schema that allows null values. * * @param wrapped The wrapped schema. * @@ -61,8 +60,7 @@ export function nullableAsync< >(wrapped: TWrapped): NullableSchemaAsync; /** - * Creates a nullable schema that allows null values but not undefined. - * Type: T | null + * Creates a nullable schema that allows null values. * * @param wrapped The wrapped schema. * @param default_ The default value. diff --git a/library/src/schemas/nullish/nullish.ts b/library/src/schemas/nullish/nullish.ts index f3790a0d7..0bf5cb1f4 100644 --- a/library/src/schemas/nullish/nullish.ts +++ b/library/src/schemas/nullish/nullish.ts @@ -44,8 +44,7 @@ export interface NullishSchema< } /** - * Creates a nullish schema that allows both null and undefined values. - * Type: T | null | undefined + * Creates a nullish schema that allows null and undefined values. * * @param wrapped The wrapped schema. * @@ -56,8 +55,7 @@ export function nullish< >(wrapped: TWrapped): NullishSchema; /** - * Creates a nullish schema that allows both null and undefined values. - * Type: T | null | undefined + * Creates a nullish schema that allows null and undefined values. * * @param wrapped The wrapped schema. * @param default_ The default value. diff --git a/library/src/schemas/nullish/nullishAsync.ts b/library/src/schemas/nullish/nullishAsync.ts index c587e0bc1..e643d0b66 100644 --- a/library/src/schemas/nullish/nullishAsync.ts +++ b/library/src/schemas/nullish/nullishAsync.ts @@ -47,8 +47,7 @@ export interface NullishSchemaAsync< } /** - * Creates a nullish schema that allows both null and undefined values. - * Type: T | null | undefined + * Creates a nullish schema that allows null and undefined values. * * @param wrapped The wrapped schema. * @@ -61,8 +60,7 @@ export function nullishAsync< >(wrapped: TWrapped): NullishSchemaAsync; /** - * Creates a nullish schema that allows both null and undefined values. - * Type: T | null | undefined + * Creates a nullish schema that allows null and undefined values. * * @param wrapped The wrapped schema. * @param default_ The default value.