Skip to content

Is the heigh argument in Long constructor required? #101

@webmaster128

Description

@webmaster128

The type definitions in @types/long define a type constructor like this:

new( low: number, high?: number, unsigned?: boolean ): Long;

The optional height allows users to write new Long(123). This is a problem as it makes it way too easy for callers to assume this is the correct number to Long conversion because it works for a very long time until it breaks.

The README marks heigh as required. The implementation works fine if unset because undefined | 0 is 0.

Is it safe to assume heigh is required and this can be considered a bug in the types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions