benmerckx / genes

Generates split ES6 modules and Typescript definitions from Haxe modules.
43 stars 8 forks source link

POC for #48 #53

Open kevinresol opened 3 years ago

kevinresol commented 3 years ago

I made a poc for #48 implementing the concept of prefixing types with "$" when inside the module they are defined.

It is quite ugly right now because I just added "$" wherever fits. But all the tests passed! 🎉

I guess we add an "internal" flag to TypeUtil.className and alike to govern the prefix.

benmerckx commented 3 years ago

This seems to be the way to go.

I guess we add an "internal" flag to TypeUtil.className and alike to govern the prefix.

Sounds good.

benmerckx commented 3 years ago

Should it be default though, or only for name clashes? Debugging experience would be slightly nicer when we can keep the class names similar as much as possible.

--

Somehow the changes cut off type names in the declarations:

image

kevinresol commented 3 years ago

Somehow the changes cut off type names in the declarations:

this must be caused by https://github.com/benmerckx/genes/pull/53/files#diff-7bf2a028528f7404eb9d69fd3d7993af0c90edc23bf610f37b4fe63b7d2df333R24 , which is a quick hack to "undo" the prefix.

Should it be default though, or only for name clashes? Debugging experience would be slightly nicer when we can keep the class names similar as much as possible.

Yes I think so, but as a POC I didn't dive deep enough to understand the logic around TypeAccessor and its relatives.