From 3e4b1bb6c5bfc394cb2f31efd058fe9546e6e977 Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Sun, 29 Sep 2024 19:08:55 +0200 Subject: [PATCH 1/4] Add missing `If` types for types starting with `Is` The corresponding `If` types for ``IsNegative`, `IsInteger`, `IsFloat`, `IsEqual`, and the `Is` types for literal types have been missing. --- index.d.ts | 11 ++++ readme.md | 18 +++--- source/if-equal.d.ts | 27 +++++++++ source/if-float.d.ts | 26 +++++++++ source/if-integer.d.ts | 26 +++++++++ source/if-literal.d.ts | 126 ++++++++++++++++++++++++++++++++++++++++ source/if-negative.d.ts | 26 +++++++++ test-d/if-equal.ts | 16 +++++ test-d/if-float.ts | 12 ++++ test-d/if-integer.ts | 12 ++++ test-d/if-literal.ts | 45 ++++++++++++++ test-d/if-negative.ts | 12 ++++ 12 files changed, 348 insertions(+), 9 deletions(-) create mode 100644 source/if-equal.d.ts create mode 100644 source/if-float.d.ts create mode 100644 source/if-integer.d.ts create mode 100644 source/if-literal.d.ts create mode 100644 source/if-negative.d.ts create mode 100644 test-d/if-equal.ts create mode 100644 test-d/if-float.ts create mode 100644 test-d/if-integer.ts create mode 100644 test-d/if-literal.ts create mode 100644 test-d/if-negative.ts diff --git a/index.d.ts b/index.d.ts index 642e3c8e0..f207b6b28 100644 --- a/index.d.ts +++ b/index.d.ts @@ -82,6 +82,7 @@ export type { NonNegativeInteger, IsNegative, } from './source/numeric'; +export type {IfNegative} from './source/if-negative'; export type {GreaterThan} from './source/greater-than'; export type {GreaterThanOrEqual} from './source/greater-than-or-equal'; export type {LessThan} from './source/less-than'; @@ -102,11 +103,14 @@ export type {WritableKeysOf} from './source/writable-keys-of'; export type {HasWritableKeys} from './source/has-writable-keys'; export type {Spread} from './source/spread'; export type {IsInteger} from './source/is-integer'; +export type {IfInteger} from './source/if-integer'; export type {IsFloat} from './source/is-float'; +export type {IfFloat} from './source/if-float'; export type {TupleToUnion} from './source/tuple-to-union'; export type {UnionToTuple} from './source/union-to-tuple'; export type {IntRange} from './source/int-range'; export type {IsEqual} from './source/is-equal'; +export type {IfEqual} from './source/if-equal'; export type { IsLiteral, IsStringLiteral, @@ -114,6 +118,13 @@ export type { IsBooleanLiteral, IsSymbolLiteral, } from './source/is-literal'; +export type { + IfLiteral, + IfStringLiteral, + IfNumericLiteral, + IfBooleanLiteral, + IfSymbolLiteral, +} from './source/if-literal'; export type {IsAny} from './source/is-any'; export type {IfAny} from './source/if-any'; export type {IsNever} from './source/is-never'; diff --git a/readme.md b/readme.md index 2f1863d7a..2d0676fbf 100644 --- a/readme.md +++ b/readme.md @@ -188,7 +188,7 @@ Click the type names for complete docs. - [`WritableKeysOf`](source/writable-keys-of.d.ts) - Extract all writable (non-readonly) keys from the given type. - [`HasWritableKeys`](source/has-writable-keys.d.ts) - Create a `true`/`false` type depending on whether the given type has any writable fields. - [`Spread`](source/spread.d.ts) - Mimic the type inferred by TypeScript when merging two objects or two arrays/tuples using the spread syntax. -- [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal. +- [`IsEqual`](source/is-equal.d.ts) - Returns a boolean for whether the two given types are equal. (Conditional version: [`IfEqual`](source/if-equal.d.ts)) - [`TaggedUnion`](source/tagged-union.d.ts) - Create a union of types that share a common discriminant property. - [`IntRange`](source/int-range.d.ts) - Generate a union of numbers. - [`ArrayIndices`](source/array-indices.d.ts) - Provides valid indices for a constant array or tuple. @@ -233,11 +233,11 @@ type ShouldBeNever = IfAny<'not any', 'not never', 'never'>; //=> 'never' ``` -- [`IsLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). -- [`IsStringLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). -- [`IsNumericLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). -- [`IsBooleanLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). -- [`IsSymbolLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). +- [`IsLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). (Conditional version: [`IfLiteral`](source/if-literal.d.ts)) +- [`IsStringLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). (Conditional version: [`IfStringLiteral`](source/if-literal.d.ts)) +- [`IsNumericLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). (Conditional version: [`IfNumericLiteral`](source/if-literal.d.ts)) +- [`IsBooleanLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). (Conditional version: [`IfBooleanLiteral`](source/if-literal.d.ts)) +- [`IsSymbolLiteral`](source/is-literal.d.ts) - Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). (Conditional version: [`IfSymbolLiteral`](source/if-literal.d.ts)) - [`IsAny`](source/is-any.d.ts) - Returns a boolean for whether the given type is `any`. (Conditional version: [`IfAny`](source/if-any.d.ts)) - [`IsNever`](source/is-never.d.ts) - Returns a boolean for whether the given type is `never`. (Conditional version: [`IfNever`](source/if-never.d.ts)) - [`IsUnknown`](source/is-unknown.d.ts) - Returns a boolean for whether the given type is `unknown`. (Conditional version: [`IfUnknown`](source/if-unknown.d.ts)) @@ -297,9 +297,9 @@ type ShouldBeNever = IfAny<'not any', 'not never', 'never'>; - [`NonNegative`](source/numeric.d.ts) - A non-negative `number`/`bigint` (`0 <= x < ∞`). - [`NegativeInteger`](source/numeric.d.ts) - A negative (`-∞ < x < 0`) `number` that is an integer. - [`NonNegativeInteger`](source/numeric.d.ts) - A non-negative (`0 <= x < ∞`) `number` that is an integer. -- [`IsNegative`](source/numeric.d.ts) - Returns a boolean for whether the given number is a negative number. -- [`IsFloat`](source/is-float.d.ts) - Returns a boolean for whether the given number is a float, like `1.5` or `-1.5`. -- [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is a integer, like `-5`, `1.0` or `100`. +- [`IsNegative`](source/numeric.d.ts) - Returns a boolean for whether the given number is a negative number. (Conditional version: [`IfNegative`](source/if-negative.d.ts)) +- [`IsFloat`](source/is-float.d.ts) - Returns a boolean for whether the given number is a float, like `1.5` or `-1.5`. (Conditional version: [`IfFloat`](source/if-float.d.ts)) +- [`IsInteger`](source/is-integer.d.ts) - Returns a boolean for whether the given number is a integer, like `-5`, `1.0` or `100`. (Conditional version: [`IfInteger`](source/if-integer.d.ts)) - [`GreaterThan`](source/greater-than.d.ts) - Returns a boolean for whether a given number is greater than another number. - [`GreaterThanOrEqual`](source/greater-than-or-equal.d.ts) - Returns a boolean for whether a given number is greater than or equal to another number. - [`LessThan`](source/less-than.d.ts) - Returns a boolean for whether a given number is less than another number. diff --git a/source/if-equal.d.ts b/source/if-equal.d.ts new file mode 100644 index 000000000..92424adcb --- /dev/null +++ b/source/if-equal.d.ts @@ -0,0 +1,27 @@ +import type {IsEqual} from './is-equal'; + +/** +An if-else-like type that resolves depending on whether the two given types are equal. + +@see {@link IsEqual} + +@example +``` +import type {IfEqual} from 'type-fest'; + +type ShouldBeTrue = IfEqual; +//=> true + +type ShouldBeBar = IfEqual<'not', 'equal', 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities +*/ +export type IfEqual< + A, + B, + TypeIfEqual = true, + TypeIfNotEqual = false, +> = IsEqual extends true ? TypeIfEqual : TypeIfNotEqual; diff --git a/source/if-float.d.ts b/source/if-float.d.ts new file mode 100644 index 000000000..24ae9e7d6 --- /dev/null +++ b/source/if-float.d.ts @@ -0,0 +1,26 @@ +import type {IsFloat} from './is-float'; + +/** +An if-else-like type that resolves depending on whether the given type is a float, like `1.5` or `-1.5`. + +@see {@link IsFloat} + +@example +``` +import type {IfFloat} from 'type-fest'; + +type ShouldBeTrue = IfFloat<3.14>; +//=> true + +type ShouldBeBar = IfFloat<'not float', 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities +*/ +export type IfFloat< + T, + TypeIfFloat = true, + TypeIfNotFloat = false, +> = IsFloat extends true ? TypeIfFloat : TypeIfNotFloat; diff --git a/source/if-integer.d.ts b/source/if-integer.d.ts new file mode 100644 index 000000000..783837eca --- /dev/null +++ b/source/if-integer.d.ts @@ -0,0 +1,26 @@ +import type {IsInteger} from './is-integer'; + +/** +An if-else-like type that resolves depending on whether the given type is an integer, like `-5`, `1.0` or `100`. + +@see {@link IsInteger} + +@example +``` +import type {IfInteger} from 'type-fest'; + +type ShouldBeTrue = IfInteger<7>; +//=> true + +type ShouldBeBar = IfInteger<'not integer', 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities +*/ +export type IfInteger< + T, + TypeIfInteger = true, + TypeIfNotInteger = false, +> = IsInteger extends true ? TypeIfInteger : TypeIfNotInteger; diff --git a/source/if-literal.d.ts b/source/if-literal.d.ts new file mode 100644 index 000000000..ba83def8e --- /dev/null +++ b/source/if-literal.d.ts @@ -0,0 +1,126 @@ +import type {IsBooleanLiteral, IsLiteral, IsNumericLiteral, IsStringLiteral, IsSymbolLiteral} from './is-literal'; + +/** +An if-else-like type that resolves depending on whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). + +@see {@link IsStringLiteral} + +@example +``` +import type {IfStringLiteral} from 'type-fest'; + +type ShouldBeTrue = IfStringLiteral<'string'>; +//=> true + +type ShouldBeBar = IfStringLiteral; +//=> 'bar' +``` + +@category Type Guard +@category Utilities + */ +export type IfStringLiteral< + T, + TypeIfStringLiteral = true, + TypeIfNotStringLiteral = false, +> = IsStringLiteral extends true ? TypeIfStringLiteral : TypeIfNotStringLiteral; + +/** +An if-else-like type that resolves depending on whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). + +@see {@link IsNumericLiteral} + +@example +``` +import type {IfNumericLiteral} from 'type-fest'; + +type ShouldBeTrue = IfNumericLiteral<1>; +//=> true + +type ShouldBeBar = IfNumericLiteral<'not numeric', 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities + */ +export type IfNumericLiteral< + T, + TypeIfNumericLiteral = true, + TypeIfNotNumericLiteral = false, +> = IsNumericLiteral extends true ? TypeIfNumericLiteral : TypeIfNotNumericLiteral; + +/** +An if-else-like type that resolves depending on whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). + +@see {@link IsBooleanLiteral} + +@example +``` +import type {IfBooleanLiteral} from 'type-fest'; + +type ShouldBeTrue = IfBooleanLiteral; +//=> true + +type ShouldBeBar = IfBooleanLiteral<'not boolean', 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities + */ +export type IfBooleanLiteral< + T, + TypeIfBooleanLiteral = true, + TypeIfNotBooleanLiteral = false, +> = IsBooleanLiteral extends true ? TypeIfBooleanLiteral : TypeIfNotBooleanLiteral; + +/** +An if-else-like type that resolves depending on whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). + +@see {@link IsSymbolLiteral} + +@example +``` +import type {IfSymbolLiteral} from 'type-fest'; + +type ShouldBeTrue = IfSymbolLiteral; +//=> true + +type ShouldBeBar = IfSymbolLiteral<'not symbol', 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities + */ +export type IfSymbolLiteral< + T, + TypeIfSymbolLiteral = true, + TypeIfNotSymbolLiteral = false, +> = IsSymbolLiteral extends true ? TypeIfSymbolLiteral : TypeIfNotSymbolLiteral; + +/** +An if-else-like type that resolves depending on whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). + +@see {@link IsLiteral} + +@example +``` +import type {IfLiteral} from 'type-fest'; + +type ShouldBeTrue = IfLiteral<"literal">; +//=> true + +type ShouldBeBar = IfLiteral<{}, 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities + */ +export type IfLiteral< + T, + TypeIfLiteral = true, + TypeIfNotLiteral = false, +> = IsLiteral extends true ? TypeIfLiteral : TypeIfNotLiteral; diff --git a/source/if-negative.d.ts b/source/if-negative.d.ts new file mode 100644 index 000000000..e50dc64d2 --- /dev/null +++ b/source/if-negative.d.ts @@ -0,0 +1,26 @@ +import type {IsNegative, Numeric} from './numeric'; + +/** +An if-else-like type that resolves depending on whether the given number is a negative number, like `-80` or `-0.123`. + +@see {@link IsNegative} + +@example +``` +import type {IfNegative} from 'type-fest'; + +type ShouldBeTrue = IfNegative<-80>; +//=> true + +type ShouldBeBar = IfNegative<0.123, 'foo', 'bar'>; +//=> 'bar' +``` + +@category Type Guard +@category Utilities +*/ +export type IfNegative< + T extends Numeric, + TypeIfNegative = true, + TypeIfNotNegative = false, +> = IsNegative extends true ? TypeIfNegative : TypeIfNotNegative; diff --git a/test-d/if-equal.ts b/test-d/if-equal.ts new file mode 100644 index 000000000..bbd5e4f0c --- /dev/null +++ b/test-d/if-equal.ts @@ -0,0 +1,16 @@ +import {expectType} from 'tsd'; +import type {IfEqual} from '../index'; + +// `IfEqual` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// Missing all generic parameters. +// @ts-expect-error +type A = IfEqual; + +// Missing `Y` generic parameter. +// @ts-expect-error +type B = IfEqual; diff --git a/test-d/if-float.ts b/test-d/if-float.ts new file mode 100644 index 000000000..c284bc6a1 --- /dev/null +++ b/test-d/if-float.ts @@ -0,0 +1,12 @@ +import {expectType} from 'tsd'; +import type {IfFloat} from '../index'; + +// `IfFloat` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// Missing generic parameter +// @ts-expect-error +type A = IfFloat; diff --git a/test-d/if-integer.ts b/test-d/if-integer.ts new file mode 100644 index 000000000..53884cb9b --- /dev/null +++ b/test-d/if-integer.ts @@ -0,0 +1,12 @@ +import {expectType} from 'tsd'; +import type {IfInteger} from '../index'; + +// `IfInteger` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// Missing generic parameter +// @ts-expect-error +type A = IfInteger; diff --git a/test-d/if-literal.ts b/test-d/if-literal.ts new file mode 100644 index 000000000..4bdef7f78 --- /dev/null +++ b/test-d/if-literal.ts @@ -0,0 +1,45 @@ +import {expectType} from 'tsd'; +import type {IfLiteral, IfStringLiteral, IfNumericLiteral, IfBooleanLiteral, IfSymbolLiteral} from '../index'; + +// `IfLiteral` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// `IfStringLiteral` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// `IfNumericLiteral` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// `IfBooleanLiteral` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// `IfSymbolLiteral` should return `true`/`false` if only `T` is specified +const symbolLiteral = Symbol(''); +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// Missing generic parameter +// @ts-expect-error +type A0 = IfLiteral; +// @ts-expect-error +type A1 = IfStringLiteral; +// @ts-expect-error +type A2 = IfNumericLiteral; +// @ts-expect-error +type A3 = IfBooleanLiteral; +// @ts-expect-error +type A4 = IfSymbolLiteral; diff --git a/test-d/if-negative.ts b/test-d/if-negative.ts new file mode 100644 index 000000000..dab0e1966 --- /dev/null +++ b/test-d/if-negative.ts @@ -0,0 +1,12 @@ +import {expectType} from 'tsd'; +import type {IfNegative} from '../index'; + +// `IfNegative` should return `true`/`false` if only `T` is specified +expectType>(true); +expectType>(false); +expectType>('T'); +expectType>('F'); + +// Missing generic parameter +// @ts-expect-error +type A = IfNegative; From 5c6a59434baf86d27082616b223a1b624ae5eff8 Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Thu, 13 Mar 2025 18:59:33 +0100 Subject: [PATCH 2/4] Remove .idea folder --- .idea/.gitignore | 5 ----- .idea/modules.xml | 8 -------- .idea/type-fest.iml | 12 ------------ .idea/vcs.xml | 6 ------ 4 files changed, 31 deletions(-) delete mode 100644 .idea/.gitignore delete mode 100644 .idea/modules.xml delete mode 100644 .idea/type-fest.iml delete mode 100644 .idea/vcs.xml diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index b58b603fe..000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index a7c249065..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/type-fest.iml b/.idea/type-fest.iml deleted file mode 100644 index 24643cc37..000000000 --- a/.idea/type-fest.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfb..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From bd03498a1366e9ec9db8ddcca4b463de264c635e Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Thu, 13 Mar 2025 19:04:18 +0100 Subject: [PATCH 3/4] Fix formatting --- index.d.ts | 308 ++++++++++++++++++++++++++--------------------------- 1 file changed, 154 insertions(+), 154 deletions(-) diff --git a/index.d.ts b/index.d.ts index 8ad444083..6a386f8fa 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,87 +1,87 @@ // Basic -export * from "./source/primitive"; -export * from "./source/typed-array"; -export * from "./source/basic"; -export * from "./source/observable-like"; +export * from './source/primitive'; +export * from './source/typed-array'; +export * from './source/basic'; +export * from './source/observable-like'; // Utilities -export type { KeysOfUnion } from "./source/keys-of-union"; -export type { DistributedOmit } from "./source/distributed-omit"; -export type { DistributedPick } from "./source/distributed-pick"; -export type { EmptyObject, IsEmptyObject } from "./source/empty-object"; -export type { IfEmptyObject } from "./source/if-empty-object"; -export type { NonEmptyObject } from "./source/non-empty-object"; -export type { UnknownRecord } from "./source/unknown-record"; -export type { UnknownArray } from "./source/unknown-array"; -export type { Except } from "./source/except"; -export type { TaggedUnion } from "./source/tagged-union"; -export type { Writable } from "./source/writable"; -export type { WritableDeep } from "./source/writable-deep"; -export type { Merge } from "./source/merge"; -export type { MergeDeep, MergeDeepOptions } from "./source/merge-deep"; -export type { MergeExclusive } from "./source/merge-exclusive"; -export type { RequireAtLeastOne } from "./source/require-at-least-one"; -export type { RequireExactlyOne } from "./source/require-exactly-one"; -export type { RequireAllOrNone } from "./source/require-all-or-none"; -export type { RequireOneOrNone } from "./source/require-one-or-none"; -export type { SingleKeyObject } from "./source/single-key-object"; -export type { OmitIndexSignature } from "./source/omit-index-signature"; -export type { PickIndexSignature } from "./source/pick-index-signature"; -export type { PartialDeep, PartialDeepOptions } from "./source/partial-deep"; -export type { RequiredDeep } from "./source/required-deep"; -export type { PickDeep } from "./source/pick-deep"; -export type { OmitDeep } from "./source/omit-deep"; +export type {KeysOfUnion} from './source/keys-of-union'; +export type {DistributedOmit} from './source/distributed-omit'; +export type {DistributedPick} from './source/distributed-pick'; +export type {EmptyObject, IsEmptyObject} from './source/empty-object'; +export type {IfEmptyObject} from './source/if-empty-object'; +export type {NonEmptyObject} from './source/non-empty-object'; +export type {UnknownRecord} from './source/unknown-record'; +export type {UnknownArray} from './source/unknown-array'; +export type {Except} from './source/except'; +export type {TaggedUnion} from './source/tagged-union'; +export type {Writable} from './source/writable'; +export type {WritableDeep} from './source/writable-deep'; +export type {Merge} from './source/merge'; +export type {MergeDeep, MergeDeepOptions} from './source/merge-deep'; +export type {MergeExclusive} from './source/merge-exclusive'; +export type {RequireAtLeastOne} from './source/require-at-least-one'; +export type {RequireExactlyOne} from './source/require-exactly-one'; +export type {RequireAllOrNone} from './source/require-all-or-none'; +export type {RequireOneOrNone} from './source/require-one-or-none'; +export type {SingleKeyObject} from './source/single-key-object'; +export type {OmitIndexSignature} from './source/omit-index-signature'; +export type {PickIndexSignature} from './source/pick-index-signature'; +export type {PartialDeep, PartialDeepOptions} from './source/partial-deep'; +export type {RequiredDeep} from './source/required-deep'; +export type {PickDeep} from './source/pick-deep'; +export type {OmitDeep} from './source/omit-deep'; export type { PartialOnUndefinedDeep, PartialOnUndefinedDeepOptions, -} from "./source/partial-on-undefined-deep"; -export type { UndefinedOnPartialDeep } from "./source/undefined-on-partial-deep"; -export type { ReadonlyDeep } from "./source/readonly-deep"; -export type { LiteralUnion } from "./source/literal-union"; -export type { Promisable } from "./source/promisable"; -export type { Arrayable } from "./source/arrayable"; +} from './source/partial-on-undefined-deep'; +export type {UndefinedOnPartialDeep} from './source/undefined-on-partial-deep'; +export type {ReadonlyDeep} from './source/readonly-deep'; +export type {LiteralUnion} from './source/literal-union'; +export type {Promisable} from './source/promisable'; +export type {Arrayable} from './source/arrayable'; export type { Opaque, UnwrapOpaque, Tagged, GetTagMetadata, UnwrapTagged, -} from "./source/tagged"; -export type { InvariantOf } from "./source/invariant-of"; -export type { SetOptional } from "./source/set-optional"; -export type { SetReadonly } from "./source/set-readonly"; -export type { SetRequired } from "./source/set-required"; -export type { SetRequiredDeep } from "./source/set-required-deep"; -export type { SetNonNullable } from "./source/set-non-nullable"; -export type { ValueOf } from "./source/value-of"; -export type { AsyncReturnType } from "./source/async-return-type"; -export type { ConditionalExcept } from "./source/conditional-except"; -export type { ConditionalKeys } from "./source/conditional-keys"; -export type { ConditionalPick } from "./source/conditional-pick"; +} from './source/tagged'; +export type {InvariantOf} from './source/invariant-of'; +export type {SetOptional} from './source/set-optional'; +export type {SetReadonly} from './source/set-readonly'; +export type {SetRequired} from './source/set-required'; +export type {SetRequiredDeep} from './source/set-required-deep'; +export type {SetNonNullable} from './source/set-non-nullable'; +export type {ValueOf} from './source/value-of'; +export type {AsyncReturnType} from './source/async-return-type'; +export type {ConditionalExcept} from './source/conditional-except'; +export type {ConditionalKeys} from './source/conditional-keys'; +export type {ConditionalPick} from './source/conditional-pick'; export type { ConditionalPickDeep, ConditionalPickDeepOptions, -} from "./source/conditional-pick-deep"; -export type { UnionToIntersection } from "./source/union-to-intersection"; -export type { Stringified } from "./source/stringified"; -export type { StringSlice } from "./source/string-slice"; -export type { FixedLengthArray } from "./source/fixed-length-array"; -export type { MultidimensionalArray } from "./source/multidimensional-array"; -export type { MultidimensionalReadonlyArray } from "./source/multidimensional-readonly-array"; -export type { IterableElement } from "./source/iterable-element"; -export type { Entry } from "./source/entry"; -export type { Entries } from "./source/entries"; -export type { SetReturnType } from "./source/set-return-type"; -export type { SetParameterType } from "./source/set-parameter-type"; -export type { Asyncify } from "./source/asyncify"; -export type { Simplify } from "./source/simplify"; -export type { SimplifyDeep } from "./source/simplify-deep"; -export type { Jsonify } from "./source/jsonify"; -export type { Jsonifiable } from "./source/jsonifiable"; -export type { StructuredCloneable } from "./source/structured-cloneable"; -export type { Schema, SchemaOptions } from "./source/schema"; -export type { LiteralToPrimitive } from "./source/literal-to-primitive"; -export type { LiteralToPrimitiveDeep } from "./source/literal-to-primitive-deep"; +} from './source/conditional-pick-deep'; +export type {UnionToIntersection} from './source/union-to-intersection'; +export type {Stringified} from './source/stringified'; +export type {StringSlice} from './source/string-slice'; +export type {FixedLengthArray} from './source/fixed-length-array'; +export type {MultidimensionalArray} from './source/multidimensional-array'; +export type {MultidimensionalReadonlyArray} from './source/multidimensional-readonly-array'; +export type {IterableElement} from './source/iterable-element'; +export type {Entry} from './source/entry'; +export type {Entries} from './source/entries'; +export type {SetReturnType} from './source/set-return-type'; +export type {SetParameterType} from './source/set-parameter-type'; +export type {Asyncify} from './source/asyncify'; +export type {Simplify} from './source/simplify'; +export type {SimplifyDeep} from './source/simplify-deep'; +export type {Jsonify} from './source/jsonify'; +export type {Jsonifiable} from './source/jsonifiable'; +export type {StructuredCloneable} from './source/structured-cloneable'; +export type {Schema, SchemaOptions} from './source/schema'; +export type {LiteralToPrimitive} from './source/literal-to-primitive'; +export type {LiteralToPrimitiveDeep} from './source/literal-to-primitive-deep'; export type { PositiveInfinity, NegativeInfinity, @@ -94,107 +94,107 @@ export type { NegativeInteger, NonNegativeInteger, IsNegative, -} from "./source/numeric"; -export type { IfNegative } from "./source/if-negative"; -export type { GreaterThan } from "./source/greater-than"; -export type { GreaterThanOrEqual } from "./source/greater-than-or-equal"; -export type { LessThan } from "./source/less-than"; -export type { LessThanOrEqual } from "./source/less-than-or-equal"; -export type { Sum } from "./source/sum"; -export type { Subtract } from "./source/subtract"; -export type { StringKeyOf } from "./source/string-key-of"; -export type { Exact } from "./source/exact"; -export type { ReadonlyTuple } from "./source/readonly-tuple"; -export type { OptionalKeysOf } from "./source/optional-keys-of"; -export type { OverrideProperties } from "./source/override-properties"; -export type { HasOptionalKeys } from "./source/has-optional-keys"; -export type { RequiredKeysOf } from "./source/required-keys-of"; -export type { HasRequiredKeys } from "./source/has-required-keys"; -export type { ReadonlyKeysOf } from "./source/readonly-keys-of"; -export type { HasReadonlyKeys } from "./source/has-readonly-keys"; -export type { WritableKeysOf } from "./source/writable-keys-of"; -export type { HasWritableKeys } from "./source/has-writable-keys"; -export type { Spread } from "./source/spread"; -export type { IsInteger } from "./source/is-integer"; -export type { IfInteger } from "./source/if-integer"; -export type { IsFloat } from "./source/is-float"; -export type { IfFloat } from "./source/if-float"; -export type { TupleToObject } from "./source/tuple-to-object"; -export type { TupleToUnion } from "./source/tuple-to-union"; -export type { UnionToTuple } from "./source/union-to-tuple"; -export type { IntRange } from "./source/int-range"; -export type { IntClosedRange } from "./source/int-closed-range"; -export type { IsEqual } from "./source/is-equal"; -export type { IfEqual } from "./source/if-equal"; +} from './source/numeric'; +export type {IfNegative} from './source/if-negative'; +export type {GreaterThan} from './source/greater-than'; +export type {GreaterThanOrEqual} from './source/greater-than-or-equal'; +export type {LessThan} from './source/less-than'; +export type {LessThanOrEqual} from './source/less-than-or-equal'; +export type {Sum} from './source/sum'; +export type {Subtract} from './source/subtract'; +export type {StringKeyOf} from './source/string-key-of'; +export type {Exact} from './source/exact'; +export type {ReadonlyTuple} from './source/readonly-tuple'; +export type {OptionalKeysOf} from './source/optional-keys-of'; +export type {OverrideProperties} from './source/override-properties'; +export type {HasOptionalKeys} from './source/has-optional-keys'; +export type {RequiredKeysOf} from './source/required-keys-of'; +export type {HasRequiredKeys} from './source/has-required-keys'; +export type {ReadonlyKeysOf} from './source/readonly-keys-of'; +export type {HasReadonlyKeys} from './source/has-readonly-keys'; +export type {WritableKeysOf} from './source/writable-keys-of'; +export type {HasWritableKeys} from './source/has-writable-keys'; +export type {Spread} from './source/spread'; +export type {IsInteger} from './source/is-integer'; +export type {IfInteger} from './source/if-integer'; +export type {IsFloat} from './source/is-float'; +export type {IfFloat} from './source/if-float'; +export type {TupleToObject} from './source/tuple-to-object'; +export type {TupleToUnion} from './source/tuple-to-union'; +export type {UnionToTuple} from './source/union-to-tuple'; +export type {IntRange} from './source/int-range'; +export type {IntClosedRange} from './source/int-closed-range'; +export type {IsEqual} from './source/is-equal'; +export type {IfEqual} from './source/if-equal'; export type { IsLiteral, IsStringLiteral, IsNumericLiteral, IsBooleanLiteral, IsSymbolLiteral, -} from "./source/is-literal"; +} from './source/is-literal'; export type { IfLiteral, IfStringLiteral, IfNumericLiteral, IfBooleanLiteral, IfSymbolLiteral, -} from "./source/if-literal"; -export type { IsAny } from "./source/is-any"; -export type { IfAny } from "./source/if-any"; -export type { IsNever } from "./source/is-never"; -export type { IfNever } from "./source/if-never"; -export type { IsUnknown } from "./source/is-unknown"; -export type { IfUnknown } from "./source/if-unknown"; -export type { IsTuple } from "./source/is-tuple"; -export type { ArrayIndices } from "./source/array-indices"; -export type { ArrayValues } from "./source/array-values"; -export type { ArraySlice } from "./source/array-slice"; -export type { ArraySplice } from "./source/array-splice"; -export type { ArrayTail } from "./source/array-tail"; -export type { SetFieldType } from "./source/set-field-type"; -export type { Paths } from "./source/paths"; -export type { AllUnionFields } from "./source/all-union-fields"; -export type { SharedUnionFields } from "./source/shared-union-fields"; -export type { SharedUnionFieldsDeep } from "./source/shared-union-fields-deep"; -export type { IsNull } from "./source/is-null"; -export type { IfNull } from "./source/if-null"; -export type { And } from "./source/and"; -export type { Or } from "./source/or"; -export type { NonEmptyTuple } from "./source/non-empty-tuple"; +} from './source/if-literal'; +export type {IsAny} from './source/is-any'; +export type {IfAny} from './source/if-any'; +export type {IsNever} from './source/is-never'; +export type {IfNever} from './source/if-never'; +export type {IsUnknown} from './source/is-unknown'; +export type {IfUnknown} from './source/if-unknown'; +export type {IsTuple} from './source/is-tuple'; +export type {ArrayIndices} from './source/array-indices'; +export type {ArrayValues} from './source/array-values'; +export type {ArraySlice} from './source/array-slice'; +export type {ArraySplice} from './source/array-splice'; +export type {ArrayTail} from './source/array-tail'; +export type {SetFieldType} from './source/set-field-type'; +export type {Paths} from './source/paths'; +export type {AllUnionFields} from './source/all-union-fields'; +export type {SharedUnionFields} from './source/shared-union-fields'; +export type {SharedUnionFieldsDeep} from './source/shared-union-fields-deep'; +export type {IsNull} from './source/is-null'; +export type {IfNull} from './source/if-null'; +export type {And} from './source/and'; +export type {Or} from './source/or'; +export type {NonEmptyTuple} from './source/non-empty-tuple'; export type { FindGlobalInstanceType, FindGlobalType, -} from "./source/find-global-type"; +} from './source/find-global-type'; // Template literal types -export type { CamelCase } from "./source/camel-case"; -export type { CamelCasedProperties } from "./source/camel-cased-properties"; -export type { CamelCasedPropertiesDeep } from "./source/camel-cased-properties-deep"; -export type { KebabCase } from "./source/kebab-case"; -export type { KebabCasedProperties } from "./source/kebab-cased-properties"; -export type { KebabCasedPropertiesDeep } from "./source/kebab-cased-properties-deep"; -export type { PascalCase } from "./source/pascal-case"; -export type { PascalCasedProperties } from "./source/pascal-cased-properties"; -export type { PascalCasedPropertiesDeep } from "./source/pascal-cased-properties-deep"; -export type { SnakeCase } from "./source/snake-case"; -export type { SnakeCasedProperties } from "./source/snake-cased-properties"; -export type { SnakeCasedPropertiesDeep } from "./source/snake-cased-properties-deep"; -export type { ScreamingSnakeCase } from "./source/screaming-snake-case"; -export type { DelimiterCase } from "./source/delimiter-case"; -export type { DelimiterCasedProperties } from "./source/delimiter-cased-properties"; -export type { DelimiterCasedPropertiesDeep } from "./source/delimiter-cased-properties-deep"; -export type { Join } from "./source/join"; -export type { Split } from "./source/split"; -export type { Words } from "./source/words"; -export type { Trim } from "./source/trim"; -export type { Replace } from "./source/replace"; -export type { StringRepeat } from "./source/string-repeat"; -export type { Includes } from "./source/includes"; -export type { Get } from "./source/get"; -export type { LastArrayElement } from "./source/last-array-element"; +export type {CamelCase} from './source/camel-case'; +export type {CamelCasedProperties} from './source/camel-cased-properties'; +export type {CamelCasedPropertiesDeep} from './source/camel-cased-properties-deep'; +export type {KebabCase} from './source/kebab-case'; +export type {KebabCasedProperties} from './source/kebab-cased-properties'; +export type {KebabCasedPropertiesDeep} from './source/kebab-cased-properties-deep'; +export type {PascalCase} from './source/pascal-case'; +export type {PascalCasedProperties} from './source/pascal-cased-properties'; +export type {PascalCasedPropertiesDeep} from './source/pascal-cased-properties-deep'; +export type {SnakeCase} from './source/snake-case'; +export type {SnakeCasedProperties} from './source/snake-cased-properties'; +export type {SnakeCasedPropertiesDeep} from './source/snake-cased-properties-deep'; +export type {ScreamingSnakeCase} from './source/screaming-snake-case'; +export type {DelimiterCase} from './source/delimiter-case'; +export type {DelimiterCasedProperties} from './source/delimiter-cased-properties'; +export type {DelimiterCasedPropertiesDeep} from './source/delimiter-cased-properties-deep'; +export type {Join} from './source/join'; +export type {Split} from './source/split'; +export type {Words} from './source/words'; +export type {Trim} from './source/trim'; +export type {Replace} from './source/replace'; +export type {StringRepeat} from './source/string-repeat'; +export type {Includes} from './source/includes'; +export type {Get} from './source/get'; +export type {LastArrayElement} from './source/last-array-element'; // Miscellaneous -export type { GlobalThis } from "./source/global-this"; -export type { PackageJson } from "./source/package-json"; -export type { TsConfigJson } from "./source/tsconfig-json"; +export type {GlobalThis} from './source/global-this'; +export type {PackageJson} from './source/package-json'; +export type {TsConfigJson} from './source/tsconfig-json'; From cbad63a8ffc62ee22c1d6b5c43cb717b30dc56a9 Mon Sep 17 00:00:00 2001 From: Alexander Ikonomou Date: Thu, 13 Mar 2025 19:07:28 +0100 Subject: [PATCH 4/4] Fix formatting --- index.d.ts | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/index.d.ts b/index.d.ts index 6a386f8fa..952375bc6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -31,22 +31,13 @@ export type {PartialDeep, PartialDeepOptions} from './source/partial-deep'; export type {RequiredDeep} from './source/required-deep'; export type {PickDeep} from './source/pick-deep'; export type {OmitDeep} from './source/omit-deep'; -export type { - PartialOnUndefinedDeep, - PartialOnUndefinedDeepOptions, -} from './source/partial-on-undefined-deep'; +export type {PartialOnUndefinedDeep, PartialOnUndefinedDeepOptions} from './source/partial-on-undefined-deep'; export type {UndefinedOnPartialDeep} from './source/undefined-on-partial-deep'; export type {ReadonlyDeep} from './source/readonly-deep'; export type {LiteralUnion} from './source/literal-union'; export type {Promisable} from './source/promisable'; export type {Arrayable} from './source/arrayable'; -export type { - Opaque, - UnwrapOpaque, - Tagged, - GetTagMetadata, - UnwrapTagged, -} from './source/tagged'; +export type {Opaque, UnwrapOpaque, Tagged, GetTagMetadata, UnwrapTagged} from './source/tagged'; export type {InvariantOf} from './source/invariant-of'; export type {SetOptional} from './source/set-optional'; export type {SetReadonly} from './source/set-readonly'; @@ -58,10 +49,7 @@ export type {AsyncReturnType} from './source/async-return-type'; export type {ConditionalExcept} from './source/conditional-except'; export type {ConditionalKeys} from './source/conditional-keys'; export type {ConditionalPick} from './source/conditional-pick'; -export type { - ConditionalPickDeep, - ConditionalPickDeepOptions, -} from './source/conditional-pick-deep'; +export type {ConditionalPickDeep, ConditionalPickDeepOptions} from './source/conditional-pick-deep'; export type {UnionToIntersection} from './source/union-to-intersection'; export type {Stringified} from './source/stringified'; export type {StringSlice} from './source/string-slice'; @@ -162,10 +150,7 @@ export type {IfNull} from './source/if-null'; export type {And} from './source/and'; export type {Or} from './source/or'; export type {NonEmptyTuple} from './source/non-empty-tuple'; -export type { - FindGlobalInstanceType, - FindGlobalType, -} from './source/find-global-type'; +export type {FindGlobalInstanceType, FindGlobalType} from './source/find-global-type'; // Template literal types export type {CamelCase} from './source/camel-case';