stephenh / ts-poet

A code generator DSL for typescript
Apache License 2.0
103 stars 13 forks source link

Cannot import SymbolSpec #3

Closed nao50 closed 3 years ago

nao50 commented 4 years ago

Thank you for the wonderful library. I have one question.

Problems I cannot import SymbolSpec as follows:

import { SymbolSpec } from 'ts-poet';

Question SymbolSpecs could be imported, but could you tell me the way of writing that can achieve the function equivalent to SymbolSpec.from() via SymbolSpecs?

Or should I change ts-poet/src/index.ts like TypeNames as follows?

export * from './SymbolSpecs';

Thanks.

stephenh commented 4 years ago

Thank you for the wonderful library.

Thanks!

I cannot import SymbolSpec as follows:

Ah yeah, that is odd.

export * from './SymbolSpecs';

Yeah, I think that'd be a good fix.

Looking at it a little bit, I'm also wondering if maybe the two SymbolSpec and SymbolSpecs classes should be merged. The fact that they are separate is kind of a hold-over from one of the "*-poet" libraries I ported this from, and I think their idea was that SymbolSpecs had all of the static factory functions for each SymbolSpec subclass.

But I don't know if this is a necessary distinction.

So, anyway, if you'd like to submit a PR that combines the two SymbolSpec and SymbolSpecs types into just a single SymbolSpec, I think that'd be cool, but also just a simple PR to export both of them from index.ts for now is great too.

Thanks!

stephenh commented 3 years ago

SymbolSpec has since been renamed to Import.