Option to make output typings comply tslint-immutable rules:
readonly keywordSounds good. Also, it makes sense if you are using apollo-client, because it also return an immutable results.
@BjornMelgaard what do you think about creating a PR for this?
@dotansimha , ok, it seems not so hard to add 2 new templates :smile: , I'll try on weekends.
@BjornMelgaard I think that we should allow to create config file for the generator.
At the moment I added support for gql-gen.json file, but the config there is for the generator code only, but I think we can extend it for generator-specific configuration.
This way the immutable feature will be on the same TS generator, instead of creating a new one.
What do you think?
@dotansimha ok, no new templates, just integrate this functionality in existing typescript-multi-file and typescript-single-file and activate it with something like
{
"immutable": true/false,
"flattenTypes": true,
"primitives": {
"String": "string",
"Int": "number",
"Float": "number",
"Boolean": "boolean",
"ID": "string"
},
"customHelpers": {
"myHelper": "./my-helper.js"
}
}
At the moment I added support for gql-gen.json file, but the config there is for the generator code only, but I think we can extend it for generator-specific configuration.
If I correctly understand you, you just saying that there is no way to access user config option (like "immutable" or "flattenType" above) in handlebars template and you want to add it
@dotansimha hi, how its going?
how can I get 'immutable' property from users config in handlebars template? :smiley:
@BjornMelgaard I'm implementing this right now :)
Seems like the PR above is now merged! Would it be possible to continue work on this issue now?
@jonaskello @srghma implemented in: https://github.com/dotansimha/graphql-code-generator/pull/293 :)
Done in 0.9.0 :)
Most helpful comment
@BjornMelgaard I'm implementing this right now :)