stephenh / ts-poet

A code generator DSL for typescript
Apache License 2.0
100 stars 12 forks source link

README Example doesn't generate expected code. #53

Closed ws-gregm closed 11 months ago

ws-gregm commented 11 months ago
@ws-gregm ➜ (staging) $ ts-node src/bin/gen

export class Greeter {

  private name: string;

  constructor(private name: string) {
  }

  greet(): <string> {
    return .from(`Hello $name`);
  }

}

Should see Observable.from(`Hello $name`);, However, Observable doesn't appear as per the example.

stephenh commented 11 months ago

Ah yeah, the readme example comes from a really old precursor to ts-poet, so used an out-dated imp syntax; I've updated it to use:

const Observable = imp("Observable@rxjs");

And you should see it work. See the "Import Specs" section for other valid import specs.

Thanks for the report!

ws-gregm commented 11 months ago

Perfect! Thank you so much.