stephenh / ts-poet

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

Custom import aliases are not supported #24

Closed YeeJone closed 2 years ago

YeeJone commented 2 years ago

Like:
import { XXX as CustomizedXXX } from 'packages/override-properties/XXXX';

stephenh commented 2 years ago

Ah yeah, that seems worth supporting...

I was thinking imp("XXX:CustomizedXXX@packages/override-properties/XXX") would be a good syntax for that.

Technically the : operator is already "taken" by the t: prefix I added for type-only imports...

But we could probably support both, and just still use : i.e.

imp("t:XXX:CustomizedXXX@packages/override-properties/XXX")

Would be:

import type { XXX as CustomizedXXX } from 'packages/override-properties/XXXX';

Open to better suggestions than the : separator.

If you'd like to submit a PR, that'd be great. Thanks!