creditkarma / thrift-typescript

Generate TypeScript from Thrift IDL files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using make with custom namespaces throws error

ricsmania opened this issue · comments

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.