diff --git a/type-plus/ts/equal/equal.ts b/type-plus/ts/equal/equal.ts index 0be09400f9..f2ac355b29 100644 --- a/type-plus/ts/equal/equal.ts +++ b/type-plus/ts/equal/equal.ts @@ -1,6 +1,6 @@ import type { IsAny } from '../any/is_any.js' import type { IsNever } from '../never/is_never.js' -import type { IsObject } from '../object/object_type.js' +import type { IsObject } from '../object/is_object.js' import type { Properties } from '../object/properties.js' import type { And, Or } from '../predicates/logical.js' import type { IsSymbol } from '../symbol/symbol_type.js' diff --git a/type-plus/ts/index.ts b/type-plus/ts/index.ts index c6e23bd49c..88d8a568da 100644 --- a/type-plus/ts/index.ts +++ b/type-plus/ts/index.ts @@ -77,9 +77,11 @@ export * as NumericPlus from './numeric/numeric_plus.js' export type * from './numeric/numeric_type.js' export type { Required, RequiredExcept, RequiredPick } from './object/Required.js' export * from './object/index.js' +export type * from './object/is_not_object.js' +export type * from './object/is_object.js' export type * from './object/is_strict_object.js' export * as ObjectPlus from './object/object_plus.js' -export type { IsNotObject, IsObject, NotObjectType, ObjectType } from './object/object_type.js' +export type { NotObjectType, ObjectType } from './object/object_type.js' export * from './predicates/index.js' export type { PrimitiveTypes } from './primitive.js' export * from './promise/index.js' diff --git a/type-plus/ts/object/object_type.is_not_object.spec.ts b/type-plus/ts/object/is_not_object.spec.ts similarity index 100% rename from type-plus/ts/object/object_type.is_not_object.spec.ts rename to type-plus/ts/object/is_not_object.spec.ts diff --git a/type-plus/ts/object/is_not_object.ts b/type-plus/ts/object/is_not_object.ts new file mode 100644 index 0000000000..2e68dabec9 --- /dev/null +++ b/type-plus/ts/object/is_not_object.ts @@ -0,0 +1,17 @@ +import type { ObjectType } from './object_type.js' + +/** + * Is `T` not an `object`. + * + * Note that `Function` is also an `object`. + * + * ```ts + * type R = IsNotObject<{}> // false + * type R = IsNotObject<{ a: 1 }> // false + * type R = IsNotObject // false + * + * type R = IsNotObject // true + * ``` + */ + +export type IsNotObject = ObjectType diff --git a/type-plus/ts/object/object_type.is_object.spec.ts b/type-plus/ts/object/is_object.spec.ts similarity index 100% rename from type-plus/ts/object/object_type.is_object.spec.ts rename to type-plus/ts/object/is_object.spec.ts diff --git a/type-plus/ts/object/is_object.ts b/type-plus/ts/object/is_object.ts new file mode 100644 index 0000000000..b5c0839f80 --- /dev/null +++ b/type-plus/ts/object/is_object.ts @@ -0,0 +1,17 @@ +import type { ObjectType } from './object_type.js' + +/** + * Is `T` an `object`. + * + * Note that `Function`, `Array`, and *tuple* are also `object`. + * + * ```ts + * type R = IsObject<{}> // true + * type R = IsObject<{ a: 1 }> // true + * type R = IsObject // true + * + * type R = IsObject // false + * ``` + */ + +export type IsObject = ObjectType diff --git a/type-plus/ts/object/is_strict_object.ts b/type-plus/ts/object/is_strict_object.ts index b28fec9065..699132e797 100644 --- a/type-plus/ts/object/is_strict_object.ts +++ b/type-plus/ts/object/is_strict_object.ts @@ -1,6 +1,6 @@ import type { IdentityEqual } from '../equal/identity_equal.js' import type { IsNever } from '../never/is_never.js' -import type { IsObject } from './object_type.js' +import type { IsObject } from './is_object.js' /** * 🎭 *predicate* diff --git a/type-plus/ts/object/object_type.ts b/type-plus/ts/object/object_type.ts index b9f9c15153..801b412e8c 100644 --- a/type-plus/ts/object/object_type.ts +++ b/type-plus/ts/object/object_type.ts @@ -17,21 +17,6 @@ export type ObjectType = IsAnyOrNever // true - * type R = IsObject<{ a: 1 }> // true - * type R = IsObject // true - * - * type R = IsObject // false - * ``` - */ -export type IsObject = ObjectType - /** * Check if `T` is not an `object`. * @@ -44,18 +29,3 @@ export type IsObject = ObjectType * ``` */ export type NotObjectType = ObjectType - -/** - * Is `T` not an `object`. - * - * Note that `Function` is also an `object`. - * - * ```ts - * type R = IsNotObject<{}> // false - * type R = IsNotObject<{ a: 1 }> // false - * type R = IsNotObject // false - * - * type R = IsNotObject // true - * ``` - */ -export type IsNotObject = ObjectType diff --git a/type-plus/ts/testing/test_type.ts b/type-plus/ts/testing/test_type.ts index 2dc4b1dbe7..ac5b79bc0b 100644 --- a/type-plus/ts/testing/test_type.ts +++ b/type-plus/ts/testing/test_type.ts @@ -13,7 +13,7 @@ import type { IsNever } from '../never/is_never.js' import type { IsNull } from '../null/is_null.js' import type { IsNumber } from '../number/is_number.js' import type { IsStrictNumber } from '../number/is_strict_number.js' -import type { IsObject } from '../object/object_type.js' +import type { IsObject } from '../object/is_object.js' import type { CanAssign, StrictCanAssign } from '../predicates/CanAssign.js' import type { IsStrictString } from '../string/strict_string_type.js' import type { IsString } from '../string/string_type.js'