Skip to content

Conversation

PumpedSardines
Copy link

PR to address my complaint in issue #27. Instead of the return type being true or false, the function should return if the value is a object or not.

@windusayles
Copy link

The point of this function is to return true or false if the value passed in is an object, and it does. I don't understand your issue.

@PumpedSardines
Copy link
Author

@windusayles Take this following example if "isObject" returns a bool

const myVariable: unknown = ({ foo: "bar" }) as any;

if(isObject(myVariable)) {
   // TypeScript still sees myVariable as unknown in this scope
}

And this is an example if isObject returns val is { [key: string]: unknown }

const myVariable: unknown = ({ foo: "bar" }) as any;

if(isObject(myVariable)) {
   // TypeScript now sees myVariable as { [key: string]: unknown }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants