[ https://issues.apache.org/jira/browse/THRIFT-4899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James E. King III updated THRIFT-4899: -------------------------------------- Component/s: (was: JavaScript - Compiler) Java - Compiler > Generated TypeScript declarations incorrectly references types when there is > more than 1 include > ------------------------------------------------------------------------------------------------ > > Key: THRIFT-4899 > URL: https://issues.apache.org/jira/browse/THRIFT-4899 > Project: Thrift > Issue Type: Bug > Components: Java - Compiler > Affects Versions: 0.13.0 > Reporter: Phil Price > Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > When a service or type definition has multiple includes that are referenced > in method parameters or responses the TypeScript generator will generated > code that will fail to compile with tsc. This is due to "external" types not > being referenced from their import; an assumption is made that they are > defined the the default ttypes for the service. > ---- > With the following input > {code:java} > import "Other.thrift" > struct MyStruct { > 1:Other.OtherType field; > } > service MyService { > Other.OtherResponse magic(1:Other.OtherRequest arg) > }{code} > The following generated TypeScript declaration is generated with 0.13.0 which > will fail to compile with an invocation of "tsc *.d.ts" > {code:java} > // foo_types.d.ts > import other_types = require("./other"); > declare class MyStruct { > public field: OtherType; // !!! Compile failure, unknown type OtherType > } > // foo_service.d.ts > import other_types = require("./other"); > class MyService { > public magic(request: OtherRequest) : Promise<OtherResponse> // !!! > Compile failure, unknown type OtherRequest, OtherResponse > } > {code} > The expected output *should* be: > {code:java} > // foo_types.d.ts > import other_types = require("./other"); > declare class MyStruct { > public field: other_types.OtherType; > } > // foo_service.d.ts > import other_types = require("./other"); > class MyService { > public magic(request: other_types.OtherRequest) : > Promise<other_types.OtherResponse> > } > {code} > I have a fix for this with the following PR > [https://github.com/apache/thrift/pull/1820] > -- This message was sent by Atlassian JIRA (v7.6.3#76005)