Using graphql-codegen
to generate Typescript types and operations works like a charm using the typescript
and typescript-operations
plugins.
However the typescript
plugin emits types that use Scalar types instead of primitive types:
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
};
export type Account = {
__typename?: 'Account';
created: Scalars['String'];
}
Can graphql-codegen be configured to emit their primitive counterparts instead? Like so:
export type Account = {
__typename?: 'Account';
created: string; // instead of Scalars['String']
}
I've written a custom plugin which drills through all the object's properties, matches correct objects and changes the types, but it is a laborious task. Is there a way to achieve this in a cleaner way?