reinforced / Reinforced.Typings

Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free
MIT License
507 stars 82 forks source link

Generate `type`s instead of `interface`s and `enum`s #280

Open gustavo-shigueo opened 3 months ago

gustavo-shigueo commented 3 months ago

Is it possible to generate TypeScript ´typedeclarations instead ofinterface`s? If not can it be added to the library similar to this:

[TsType]
class Foo {
    int Bar;
}
type Foo = { Bar: number }
zolakt commented 1 month ago

Enums to types would be a great addition. Maybe someone has an existing workaround for that?

pavel-b-novikov commented 1 month ago

For types support there should be implemented additional synax nodes. Unfortunately, I don't have time currently for such a change :(

Actually it can be done using exising architecture even without modifying the source code. I would appreciate if someone will do that in a way I could integrate it into the product

gustavo-shigueo commented 1 month ago

Enums to types would be a great addition. Maybe someone has an existing workaround for that?

Yes! Having type unions instead of TS enums would be very handy, especially given how bad TS enums are sometimes

gustavo-shigueo commented 1 month ago

For types support there should be implemented additional synax nodes.

At the time I opened the issue I attempted to create an AST node for types but couldn't quite figure out how to properly integrate it with the library

Unfortunately, I don't have time currently for such a change :(

I understand, maintaining OSS is really difficult, especially with all the other stuff we have to deal with

Actually it can be done using exising architecture even without modifying the source code.

How so? Can you give any pointers to how this could be achieved?