conjure-typescript icon indicating copy to clipboard operation
conjure-typescript copied to clipboard

Generated Typescript incorrect when referencing an alias of a map

Open rherms opened this issue 6 years ago • 2 comments

What happened?

The generated typescript code would not compile because of a missing import. Here is a simplification of my conjure:

Foo:
  fields:
    myField: Bar

Bar:
  alias: map<string, Baz>

Baz:
  union:
    str: string
    date: datetime

The generated code for Foo.ts did not import IBaz even though it referenced it. It looked something like:

export interface IFoo {
  myField: { [key: string]: IBaz };
}

What did you want to happen?

Valid typescript to be generated, like:

import { IBaz } from "./Baz";

export interface IFoo {
  myField: { [key: string]: IBaz };
}

rherms avatar May 30 '19 18:05 rherms

I'm improving our testing story with #90 then I'll follow up with a fix

ferozco avatar Jun 03 '19 21:06 ferozco

@rherms I've attempted to repro your issue, but I've been unable to. You can look at a my branch.

What version of conjure-typescript are you using? Can you point me in the direction of where you're seeing this issue?

ferozco avatar Jun 04 '19 13:06 ferozco