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

Nested optionals not handled correctly for Typescript #11

Open
Ben-Johnson-ck opened this issue Aug 9, 2017 · 0 comments
Open

Nested optionals not handled correctly for Typescript #11

Ben-Johnson-ck opened this issue Aug 9, 2017 · 0 comments

Comments

@Ben-Johnson-ck
Copy link

If I have the following IDL:

struct Foo {
    1: optional Bar bar
}

struct Bar {
    1: optional Baz baz
}

it will generate the following typescript:

export interface IFooArgs {
    bar?: Bar
}

export class Foo {
    public bar: Bar
}

export interface IBarArgs {
    baz?: Baz
}

export class Bar {
    public baz: Baz
}

If I construct a IFooArgs with a bar property that has NO baz, it will not parse correctly on Foo despite fulfilling the thrift contract, as baz is NOT optional on the class Bar.

It seems like the easiest solution would be to make the properties on the root class optional, but if that is not possible, the I____Args interface could be generated for all classes (currently only generated if the class has optionals) and have it use the appropriate I___Args interface for its own properties rather than the root class types directly.

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

No branches or pull requests

1 participant