tkrajina / typescriptify-golang-structs

A Golang struct to TypeScript class/interface converter
Apache License 2.0
505 stars 87 forks source link

Third-party structs with type `time.Time` convert to Time empty interface/class #33

Closed shackra closed 3 years ago

shackra commented 3 years ago

Currently, you need to explicitly add tags like ts_type:"Date" and ts_transform:"new Date(__VALUE__)" in order for the conversion to use the correct Typescript type Date for time.Time Go type. But in regard to third-party structs the developer cannot do this tag addition.

Thus, the library should handle this particular use case automatically.

Also, providing an interface that enables developers to handle these edge cases with third-party structs would be useful, like an .Add() method with additional optional arguments to control ts_type and ts_transform.