Closed ShlomiAltostra closed 1 year ago
Make sure you on the latest version: 1.5.15 https://github.com/cevek/ttypescript/releases
There were changes that addressed this issue: https://github.com/cevek/ttypescript/compare/1.5.12...1.5.14#diff-8fb112b766642acf9d525edac469bce302368688118ae8349238b7ff0606f328R32
I'm sorry
I've ran npm i ttypescript
at first, which didn't resolve the problem
I should've run npm i ttypescript@latest
Trying to compile code on nodejs version 16.18 or above fails with the following error:
As much as I investigated - this is due to a change in how the
Module
object is constructed. When theTypeScriptModule
constructor runs, thethis
object already has own-property namedexports
initialized with an empty object{}
.That property shadows the class property, preventing its getter from running, and the call to
_init
In my setup, adding![image](https://user-images.githubusercontent.com/57314279/211332574-500b7bf9-df12-4ca0-a6df-aeddd36bb11f.png)
delete this.exports
to the constructor fixes the problem as it deletes that own-property, exposing the class property again - but this wasn't tested thoroughly