Giter Club home page Giter Club logo

Comments (6)

AdrianWilczynski avatar AdrianWilczynski commented on July 18, 2024 1

Generic nullables should be fixed now. I've added configuration settings to pick output types for them (-n|--convert-nullables-to <Null|Undefined>) and for dates (-d|--convert-dates-to <String|Date|Union>).

I've also implemented your comments idea (-p|--partial-override). Thanks.

from csharptotypescript.

AdrianWilczynski avatar AdrianWilczynski commented on July 18, 2024

Thanks for the report.

I wasn't really aware of this generic nullable syntax. I'm gonna fix it. Types declared with question mark (bool? IsGenericLender) should work though.

As far as dates go, there isn't any way to change it right now but I can add a configuration setting that would let you pick between string, Date and maybe string | Date. Would that work for you?

from csharptotypescript.

richarddavenport avatar richarddavenport commented on July 18, 2024

I was told the Nullable<T> syntax came from some entity framework generated code. I hadn't ever seen it before either.

The configuration option sounds great. If it's too much work, let me know what I can do to help.

I had one other question, but didn't want to open another issue. What do you think about just updating the output, rather than rewriting the file? Or if there is a way to have imports automatically inserted. I know that is a big ask.

from csharptotypescript.

AdrianWilczynski avatar AdrianWilczynski commented on July 18, 2024

Configuration option should be easy to add.

I'm not sure what you mean by updating the output. Do you mean only overriding old generated file if source changed so manually added imports aren't erased for no reason? I guess naive, simple way to do it would be to just check if old output ends with/contains new output and, if so, just leave it alone? Maybe that could work?

I can't really think about any way to do it more precisely since I'm not doing any TypeScript parsing or storing any state of source files. Overriding only specific parts of generated file seems kinda hard to do. Do you have some ideas?

I didn't implement imports generation yet because only CLI could make any use of it and I'm not sure if I can do it robustly enough. I think I could collect declared and required types for every file and pair them to generate imports. I'll try to play with it over the long weekend and see how it goes.

from csharptotypescript.

richarddavenport avatar richarddavenport commented on July 18, 2024

Thanks, really appreciate it.

You could add comments to the generated code and anything modified outside the comments could be left alone. Basically if I add import statements to my files and then run the cli, the imports are removed because the file is regenerated.

from csharptotypescript.

richarddavenport avatar richarddavenport commented on July 18, 2024

Awesome! I'll give it a shot. Thanks so much!

from csharptotypescript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.