Closed sampaioletti closed 5 years ago
Hey. Thanks for your PR. But isn't this fixed as part of 40d2ea83206c868d18b17746e7f7e6d8bbada9af (v0.0.7). The test there is using a type alias with:
type NumberTime time.Time
instead of
type MSTime struct{
time.Time
}
I added a test in master (7bd3a6183d4aa65719d01156770b1b4dd99db82a) and it seems it works. Am I missing something?
Sorry I'll have to look into it more, but the point wasn't necessarily time.Time it was that in what i was doing at the time i was trying to override the automatic type with ts_type. It seemed to me like ts_type should have precedence when present. i.e. if I want a number field to be a string (and I'm Marshal/Unmarshaling it that way) then having a ts_type tag present should modify the type regardless of what Go type is used.
That was the idea at least.
Exactly, but I think that's exactly what I tested here: https://github.com/tkrajina/typescriptify-golang-structs/commit/7bd3a6183d4aa65719d01156770b1b4dd99db82a#diff-87e3b12606c502fc81d62ed6ea4b2873R325
I think, what you wanted is that the generated Typescript code generates birth: number;
instead of time: number;
(as it seems to be in 0.0.7) instead of time: MSTime;
(as it was in 0.0.6).
Anyway, I'll leave this open in case I overlooked something. Feel free to follow up here.
Ran into this on current project. Use case involved having a custom type i.e.
With a custom MarshallJSON/UnmarshalJSON that converted the time to/from epoch ms timestamp. So I wanted it to appear as a number type in my .ts files not a 'MSTime' Class.