Some field names inside an interface are being declared with single quotes, while others aren't. Personally I prefer no quotes but either way consistency would be nice.
I have a use case where I don't want to pollute typescript's scope with additional types, I made a tiny hack wrapper that removes type duplication prevention but I think it'd be really cool if it was included in the library itself.
Also thanks for the awesome library.
I think there needs to be a flag for prepending export ... to the interface to be able to import it from other files.
I'm using this in tests, to automatically write the interface to a file. But on subsequent runs the file gets overwritten. If I add export manually, it gets overwritten.
I am trying to convert a selection in my code to interface, but it fails as single comma is not a valid identifier in JSON schema. But this will be super helpful if i could just select an object from the code and be able to generate typescript interface for it.
I wish there was some kind of toggle for nullable fields. I don't need "null | " scattered throughout my definitions and an option to not generate that would be great.
I'd like if this service would provide a way to pass json code in the URL, similarly in an API way. Maybe having a REST API wouldn't be so bad either, I don't think any of the 'rivals' support that as of now.
When generating definition files with json-to-ts (either in vs code or directly via the npm module), it puts the question mark for an optional key right inside the key string. Instead of outside of it.
See:
{'features-CC_LMIV_25-Fanggerätkategorie_tlcm?': string[];// (..) m?': (..) should be (..) m'?: (..)}
This is more a feature for the vs code extension specifically, but it would be nice if instead of pasting into the current file it would create a new file named after the interface per interface it parses out of a response. Especially if I could specify a root directory to put these interface definitions inside of.
TypeError: Reduce of empty array with no initial value
at Array.reduce (<anonymous>)
at pascalCase (.../node_modules/json-to-ts/build/src/get-names.js:82:10)
I tried change
- .reduce(function (a, b) { return a + b; });+ .reduce(function (a, b) { return a + b; }, '');
And it works.
I think this workaround is not good enough, there maybe a bigger problem inside.