diff --git a/source/index.ts b/source/index.ts index 7e68ccb..a7281b9 100644 --- a/source/index.ts +++ b/source/index.ts @@ -260,7 +260,8 @@ is.primitive = (value: unknown): value is Primitive => is.null_(value) || isPrim is.integer = (value: unknown): value is number => Number.isInteger(value as number); is.safeInteger = (value: unknown): value is number => Number.isSafeInteger(value as number); -is.plainObject = (value: unknown): value is Record => { +type ObjectKey = string | number | symbol; +is.plainObject = (value: unknown): value is Record => { // From: https://github.com/sindresorhus/is-plain-obj/blob/master/index.js if (toString.call(value) !== '[object Object]') { return false; @@ -494,7 +495,7 @@ interface Assert { primitive: (value: unknown) => asserts value is Primitive; integer: (value: unknown) => asserts value is number; safeInteger: (value: unknown) => asserts value is number; - plainObject: (value: unknown) => asserts value is Record; + plainObject: (value: unknown) => asserts value is Record; typedArray: (value: unknown) => asserts value is TypedArray; arrayLike: (value: unknown) => asserts value is ArrayLike; domElement: (value: unknown) => asserts value is HTMLElement; @@ -591,7 +592,7 @@ export const assert: Assert = { primitive: (value: unknown): asserts value is Primitive => assertType(is.primitive(value), AssertionTypeDescription.primitive, value), integer: (value: unknown): asserts value is number => assertType(is.integer(value), AssertionTypeDescription.integer, value), safeInteger: (value: unknown): asserts value is number => assertType(is.safeInteger(value), AssertionTypeDescription.safeInteger, value), - plainObject: (value: unknown): asserts value is Record => assertType(is.plainObject(value), AssertionTypeDescription.plainObject, value), + plainObject: (value: unknown): asserts value is Record => assertType(is.plainObject(value), AssertionTypeDescription.plainObject, value), typedArray: (value: unknown): asserts value is TypedArray => assertType(is.typedArray(value), AssertionTypeDescription.typedArray, value), arrayLike: (value: unknown): asserts value is ArrayLike => assertType(is.arrayLike(value), AssertionTypeDescription.arrayLike, value), domElement: (value: unknown): asserts value is HTMLElement => assertType(is.domElement(value), AssertionTypeDescription.domElement, value),