Skip to content

typescript-operations, I want to use query result interface #4990

Answered by dotansimha
SmileJayden asked this question in General
Discussion options

You must be logged in to vote

Hi @SmileJayden ,

We had long discussion here about the differences. In the end, it's a matter of preference and what you are used to.

I can only recommend the following:

  • Use more fragments. Fragments makes it easier to understand what fields you actually need per each type in your schema, and the codegen generates types for fragments, so it makes it easier to reuse. It's also easier to pass fragment type to component props.

  • Create a file that does the following:

export * from './types.tsx';
import { MyQuery } from './types.tsx';

export const MyType = MyQuery['type'][number];

It will eliminate the amount of aliasing you have to do, and put them all in one place.

  • Use typescript-co…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@SmileJayden
Comment options

@dotansimha
Comment options

@SmileJayden
Comment options

Answer selected by SmileJayden
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants