Tuesday, 30 July 2019

reflect typescript class from string

https://stackoverflow.com/questions/15338610/dynamically-loading-a-typescript-class-reflection-for-typescript

https://stackoverflow.com/questions/20985117/create-a-new-class-using-a-string-name-in-typescript/21159196


window does work in nodejs, i also tried their codes in typescript playground, none of them work.


namespace solution works , but it only works with export namespace xxx { class}

however, once you have one class exported the namespace, you cannot add another one to this namespace. and export namespace is no more namespace now.



Only below two works:

https://stackoverflow.com/a/48487681/3070470


https://stackoverflow.com/a/55618395/3070470


truly reflect an instance from a string.

No comments:

Post a comment