Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type parameters are not substituted or generated in some cases #349

Closed
trilis opened this issue Aug 4, 2020 · 0 comments
Closed

Type parameters are not substituted or generated in some cases #349

trilis opened this issue Aug 4, 2020 · 0 comments
Milestone

Comments

@trilis
Copy link
Contributor

trilis commented Aug 4, 2020

There are several cases where type parameters are not handled properly. Here are some examples:

Object type

source:

declare class B<T> {
    f(x: { f: Array<T> })
} 

generated:

external interface `T$0` {
    var f: Array<T>
}

external open class B<T> {
    open fun f(x: `T$0`)
}

Interface T$0 is lacking type parameter T.

Type alias with type parameter

source:

type Or<T, U> = { f: T } | { g: U }

declare class B {
    f(x: Or<number, string>)
} 

generated:

external interface `T$0`<T> {
    var f: T
}

external interface `T$1`<U> {
    var g: U
}

external open class B {
    open fun f(x: `T$0`<T>)
    open fun f(x: `T$1`<U>)
}

T and U are not substituted with number and string.

Default type parameter inside type alias

source:

type ComplexType<A, B, C = Array<A>> = A | B | C

declare class A {
    x: ComplexType<number, string>
} 

generated:

external open class A {
    open var x: dynamic /* Number | String | C */
}

C is not substituted with Array<Number>.

@trilis trilis linked a pull request Aug 4, 2020 that will close this issue
@trilis trilis changed the title Type parameters are not substituted or generated with actual types in some cases Type parameters are not substituted or generated in some cases Aug 4, 2020
@Schahen Schahen added this to the 0.5.8 milestone Aug 4, 2020
@trilis trilis closed this as completed Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants