Skip to content

Type annotation for mathjs.unit is not correct #3637

@mia-trilo

Description

@mia-trilo

Describe the bug
In index.d.ts, the unit function is annotated as unit(value: MathNumericType, unit?: string): Unit. However, according to the documentation, the valid calls are

math.unit(value: number, valuelessUnit: string) : Unit
math.unit(value: number, valuelessUnit: Unit) : Unit
math.unit(unit: string) : Unit
math.unit(unit: Unit) : Unit

I believe the unit function should be typed as unit(value: MathNumericType, unit?: string | Unit): Unit

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