tkrajina / typescriptify-golang-structs

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

Some changes #3

Closed Fank closed 6 years ago

tkrajina commented 6 years ago

Hi @Fank,

I'm glad you're using this library and are willing to improve it. The reason why I'm slow in responding to it is the following, it's hard to make a review of one big pull request. It would be a lot simpler if:

The second point is more important than the first. Because your code introduces functionalities I don't use in my own project(s). But I'll still have to fix bugs if somebody reports them in the future. At least having test cases to reproduce those functionalities would help me a lot.

So, let's discuss how to fix this and merge your branch. Can you make a quick overview of the new functionalities you introduced, and then let's write unit tests for them. I realise I myself need more tests for my existing codebase and to fix that I can start writing tests in master, and then you'll have a template on how to write tests for your own branch. What do you think?

Fank commented 6 years ago

Ehm yea sure, i only want to bring all changes back to the origin. I use this project in our company to sync Frontend with information from the backend. I do not put a huge amount of love in it, i only made it work for the case i want. There are some thing i will do:

You could add me as maintainer if you want, because i think ill use project a longer time and sometimes i find something i need change. I know same rule as default don't push on master, make a PR for review ...

Fank commented 6 years ago

FYI this is my current usecase (cli application):

    converter := typescriptify.New()
    converter.Indent = ctx.String("indent")
    converter.Prefix = ctx.String("prefix")
    converter.Suffix = ctx.String("suffix")
    converter.UseInterface = !ctx.Bool("class")
    converter.CreateConstructor = ctx.Bool("constructor")
    converter.CreateEmptyObject = ctx.Bool("emptyobject")
    converter.AllOptional = true

    converter.RegisterDateType(reflect.TypeOf(types.SQLTime{}))
    converter.RegisterDateType(reflect.TypeOf(types.SQLNullTime{}))

    converter.Add(negsoft.LegacyResponse{})
    ....

    return converter.ConvertToFile(ctx.String("filename"))
tkrajina commented 6 years ago

Closing, discussion on https://github.com/tkrajina/typescriptify-golang-structs/pull/4