Which packages are impacted by your issue?
@graphql-codegen/typescript-operations
Describe the bug
When setting immutableTypes to true in the config of the plugin typescript-operations, the result types for an input having a list is Array instead of ReadonlyArray.
It works well for not input types though.
Your Example Website or App
https://github.com/vinassefranche/codegen-immutable-types-not-set-on-input
Steps to Reproduce the Bug or Issue
- run
pnpm run generate
- look at the generated
types.ts file
- see the type of
SomeInput['books'] using Array<string>
Expected behavior
the type of SomeInput['books'] should use ReadonlyArray<string>
Screenshots or Videos
No response
Platform
- OS: Linux
- NodeJS: 24.15.0
graphql version: 16.10.0
@graphql-codegen/* version(s): 7.0.0
Codegen Config File
import {CodegenConfig} from '@graphql-codegen/cli';
const config: CodegenConfig = {
schema: 'schema.graphql',
documents: 'document.graphql',
generates: {
'types.ts': {
plugins: ['typescript-operations'],
config: {
immutableTypes: true,
}
},
},
};
export default config;
Additional context
Here's a pull request that attempts to fix the issue: #10806
Which packages are impacted by your issue?
@graphql-codegen/typescript-operations
Describe the bug
When setting
immutableTypesto true in the config of the plugintypescript-operations, the result types for an input having a list isArrayinstead ofReadonlyArray.It works well for not input types though.
Your Example Website or App
https://github.com/vinassefranche/codegen-immutable-types-not-set-on-input
Steps to Reproduce the Bug or Issue
pnpm run generatetypes.tsfileSomeInput['books']usingArray<string>Expected behavior
the type of
SomeInput['books']should useReadonlyArray<string>Screenshots or Videos
No response
Platform
graphqlversion: 16.10.0@graphql-codegen/*version(s): 7.0.0Codegen Config File
Additional context
Here's a pull request that attempts to fix the issue: #10806