Skip to content

Imported generic type does not show parameters #416

Description

@yogeshsajanikar

If a generic type is imported, it does not have parameters. This results in a compilation error.

For example, following typescript declaration will result in incorrect fsharp declaration.

module Compare {
export declare type OrderedComparator<T, U = T> = (lhs: T, rhs: U) => number;
}

module SortedArray {
    import {OrderedComparator} from './Compare'
}
module Compare =

    type OrderedComparator<'T> =
        OrderedComparator<'T, 'T>

    type [<AllowNullLiteral>] OrderedComparator<'T, 'U> =
        [<Emit "$0($1...)">] abstract Invoke: lhs: 'T * rhs: 'U -> float

module SortedArray =
    type OrderedComparator = __Compare.OrderedComparator

The correct type should be

type OrderedComparator<'T,'U> = Compare.OrderedComparator<'T,'U>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions