Skip to content

Wrong TypeScript definition on Unit division #2185

@hw762

Description

@hw762

I don't know if I should file bug report on typing here, but here is the case:

const a: Unit = unit("1 km")
const b: Unit = unit("1 m")
const ratio: Unit = divide(a, b)

This type checks, but ratio is actually number at runtime. This causes problem as I cannot write correct code without type assertion (i.e. as unknown as number).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions