Skip to content

isEmpty() throws when used on a BigInt type #583

Description

@mesili

Problem description

isEmpty() throws a Cannot convert a BigInt value to a number.

Related code

isEmpty<T>(value: T): boolean {
return value === undefined || value === null || (isNaN(value as any) && typeof value !== "string");
}

Solution

Using isNaN(Number(value)) fixes the issue.

Discussion

Looking at the other isNaN() calls in said file it looks like some places are using Number(value) while some others don't.
I suspect some other methods would throw in the same way.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions