Closed Fank closed 5 years ago
@tkrajina if you could merge this one, i could continue open a PR with my changes
OK, finally I found a couple of hours to do a review of this PR. This is now much better, but:
go test ./...
fails (it doesn't even compile)CreateFromMethod
. If I just update to your version of Typescriptify -- you are forcing me (and other programmers) to do a typescript refactory, is this really necessary? That's not to say that I don't like your approach. Constructors are definitely nicer, but... backward compatibility.AllModelTypes
?go run example/example.go && tsc browser_test/example_output.ts
-- fails to compile example.go
. When I change it to use CreateConstructor
, the generated typescript code fails to compile.There are other commits which aren't immediately obvious what they do. For example 4dcb518545777c4662cb3641a736efea99aea3c8
. It would be a huge help if there was a test for it. Keep in mind -- if there is a feature I don't use from this project, it's still me who will fix bugs in this code later.
Ideally, I'd like the following features:
export
CreateFromMethod
and CreateConstructor
(and CreateFromMethod
should be the default for backward compatibilityAllOptional
(or the ability to define optional for only some fields, defined by the tags on fields in the Golang code)I also don't know most of it, this is just a migrate PR. Which i can't maintain, because its just the base for the next PR ill open if this is merged, which will contain my changes, where i can do all the stuff you commented above.
New stuff:
CreateEmptyObject
(this will allow generate empty objects for classes)UseInterface
(this will allow generate a interface instead of a class)RegisterDateType()
(this will allow to register custom date types as JSDate
)AllOptional
(this will export everything as optional,?
in typescript)CreateFromMethod
-> CreateConstructor (renaming)I think thats all