You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When it generates types, they come out using type indexing.
export type Coordinate = {
__typename: 'Coordinate';
x: Scalars['Int']['output']; // type indexing, instead of just x: number
y: Scalars['Int']['output']; // type indexing, instead of just x: number
};
This is okay in theory, but I've encountered a bug with typescript where if the type has Maybe<> used, then all the fields/properties that follow in that type will not be type resolved properly. See related Bug in Typescript github
As a workaround to this problem, I want all scalar types to be generated as the actual type. For example the above Coordinate type would be:
export type Coordinate = {
__typename: 'Coordinate';
x: number
y: number
};
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have this codegen.ts
With these packages installed:
When it generates types, they come out using type indexing.
This is okay in theory, but I've encountered a bug with typescript where if the type has Maybe<> used, then all the fields/properties that follow in that type will not be type resolved properly.
See related Bug in Typescript github
As a workaround to this problem, I want all scalar types to be generated as the actual type. For example the above Coordinate type would be:
But i cannot seam to find a way to achieve this.
Beta Was this translation helpful? Give feedback.
All reactions