cap-js / cds-typer

CDS type generator for JavaScript
Apache License 2.0
27 stars 8 forks source link

[FEATURE] Export const of type alias #222

Closed aschmidt93 closed 2 months ago

aschmidt93 commented 5 months ago

Description

When importing an enum from another .cds file, the generated file only exports the type alias but not the const variable. Also see #194

v0.20.1

// schema.cds
type MyEnum : String enum {
  Foo;
  Bar;
}
// service.cds
type MyEnum   :  schema.MyEnum;
// service index.ts
export type MyEnum = _de_example.MyEnum;

Suggested Solution

Export the const, too.

Alternatives

No response

Additional Context

No response

daogrady commented 3 months ago

Hi @aschmidt93 ,

I have prepared a PR to introduce this feature. Would you like to check it out before the merge?

Best, Daniel

aschmidt93 commented 2 months ago

Hi @daogrady,

thank you it works as intended.