creditkarma / thrift-typescript

Generate TypeScript from Thrift IDL files
Apache License 2.0
155 stars 32 forks source link

Using make with custom namespaces throws error #176

Open ricsmania opened 4 years ago

ricsmania commented 4 years ago

When I try to run the following code it throws an error:

import { make } from '@creditkarma/thrift-typescript';

make(`namespace java com.my.service
namespace js thrift

struct Response {
  1: string id  
}

service TestService {
  Response getState(1: Response request)
}`);

The error is:

TypeError: Cannot read property 'exports' of undefined at Object.make (/Users/ricardo/projects/jimdo/thrift-cli/node_modules/@creditkarma/thrift-typescript/src/main/index.ts:76:18)

This seems to be because the make method looks for the __ROOT_NAMESPACE__ namespace, but that doesn't exist when I use custom namespaces.

This started after I upgraded to version 3.7.6. I was using version 3.5.0 before and it worked.