Skip to content

Wrong return type inference #3622

@dvd101x

Description

@dvd101x

Some functions / methods assume that if the input is of a certain type the output will be of the same type.

math.matrix([1], 'dense', 'number').map(x=>math.unit(x,'m'))
// results in a DenseMatrix of units of type number

Maybe the dispatch system could also include information on the type that will be returned for a certain input.

math.typed('unit', {
 'number, string -> unit': (num, str) => math.unit(num, str)
})

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