isobject
isobject copied to clipboard
Implement type predicate
Summary
Currently isObject returns the type boolean, but i think it would improve the package if it returned val is { [key: string]: unknown }.
Current behaviour
const test: { example: "hello" } | string[] = ...;
if(isObject(test)) {
test.example = "world" // Error since test could be a string array
}
Improved behaviour
const test: { example: "hello" } | string[] = ...;
if(isObject(test)) {
test.example = "world" // No error
}