Comments (6)
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.
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.
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.
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.
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.
Awesome! I'll give it a shot. Thanks so much!
from csharptotypescript.
Related Issues (20)
- Use Map in JS/TS for Dictionary in C# HOT 1
- Using variable name as TypeScript comment
- how to convert to lowerCamelCase HOT 1
- Support dotnet 5 HOT 2
- Nullable for non-primitive fields
- Option to add suffix for the interface names
- Option to add custom type mapping HOT 2
- TSX support? HOT 2
- support record types HOT 4
- "C# to TypeScript" server related error occurred: "spawn dotnet ENOENT". HOT 1
- Preserve comments
- Option for no semicolons?
- Some Chinese characters trigger error
- summary tag support
- [feature request] output file name begin with capital letter
- Being able to have multiple directories/files
- CLI tool improperly recognizing directories
- DateOnly not converting to string
- Property Name Not Match CamelCase HOT 3
- Does not work when "required" keyword is used in property declarations in class
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from csharptotypescript.