Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply Prettify type to simplify types #189

Open
nullndr opened this issue Jan 10, 2025 · 2 comments
Open

Apply Prettify type to simplify types #189

nullndr opened this issue Jan 10, 2025 · 2 comments

Comments

@nullndr
Copy link

nullndr commented Jan 10, 2025

Consider the following simple code:

type Query<R extends QueryRootGenqlSelection> = FieldsSelection<QueryRoot, R>;

type Foo = Query<{
  abandonedCheckouts: {
    __args: {
      first: 10;
    };
    nodes: {
      abandonedCheckoutUrl: true;
    };
  };
}>;

The type in the hover overlay of Foo is the following:

type Foo = {
  abandonedCheckouts: Pick<{
    edges: AbandonedCheckoutEdge[];
    nodes: Pick<{
      abandonedCheckoutUrl: Scalars["URL"];
      billingAddress: (MailingAddress | null);
      ... 21 more ...;
      __typename: "AbandonedCheckout";
    }, "abandonedCheckoutUrl">[];
    pageInfo: PageInfo;
    __typename: "AbandonedCheckoutConnection";
  }, "nodes">;
}

A lot of noise is present! I would like to suggest using the Prettify<T> type in the Pick call inside Handle__Object and Handle__scalar to simplify it with just

type Foo = {
  abandonedCheckouts: {
    nodes: {
      abandonedCheckoutUrl: Scalars["URL"];
    }[];
  };
}

Would you be interested in this PR?

Copy link

linear bot commented Jan 10, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@nullndr and others