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

Don't remove additional field types with WithListsFixed #13812

Closed
1 of 2 tasks
HikaruTakakura opened this issue Sep 16, 2024 · 1 comment
Closed
1 of 2 tasks

Don't remove additional field types with WithListsFixed #13812

HikaruTakakura opened this issue Sep 16, 2024 · 1 comment
Assignees
Labels
GraphQL Related to GraphQL API issues

Comments

@HikaruTakakura
Copy link

HikaruTakakura commented Sep 16, 2024

Is this related to a new or existing framework?

Next.js

Is this related to a new or existing API?

GraphQL API

Is this related to another service?

No response

Describe the feature you'd like to request

Modify WithListsFixed to enhance type inference.

The total property generated when using @searchable will disappear during the type inference process.
I reported same problem here as a bug, but it was closed with inadequate answers, so I started this issue again.
I think type inference, not type annotation, should solve this problem.
Please see that issue for more details.

Describe the solution you'd like

Change WithListsFixed defined here as follows.

type WithListsFixed<T> =
  T extends PagedList<infer IT, infer NAME>
    ? PagedList<Exclude<IT, null | undefined>, NAME> &
        Exclude<T, keyof PagedList<any, any>>
    : T extends Record<string, unknown>
      ? {
          [K in keyof T]: WithListsFixed<T[K]>
        }
      : T

Describe alternatives you've considered

As suggested in the previous issue, the property itself can be revived by type annotation, but without the benefit of WithListsFixed.

Additional context

No response

Is this something that you'd be interested in working on?

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change
@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Sep 16, 2024
@ashika112 ashika112 added the GraphQL Related to GraphQL API issues label Sep 16, 2024
@chrisbonifacio chrisbonifacio self-assigned this Sep 18, 2024
@chrisbonifacio
Copy link
Member

chrisbonifacio commented Sep 18, 2024

Hi @HikaruTakakura, I see that you had proposed a solution to properly infer the total property without using the type helper.

I will close this and re-open the original issue to continue the discussion with the team and post any updates there

Apologies for the premature closure of your first issue

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Sep 18, 2024
@github-actions github-actions bot removed the pending-triage Issue is pending triage label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GraphQL Related to GraphQL API issues
Projects
None yet
Development

No branches or pull requests

3 participants