Skip to content

Conversation

@jwatzman
Copy link

When generating a raw_response type for a concrete fields, we may (e.g.,) still be spreading a fragment which is for an abstract type. We should cut down our type selections based on the actual concrete type of the field, to generate more specific raw_response types. We should also mark the selections has having the same concrete type as our field, preventing redundant arms of the final TypeScript/Flow union types from being output.

This makes the output raw response types a lot more pleasant to work with.

Fixes #5090

When generating a raw_response type for a concrete fields, we may
(e.g.,) still be spreading a fragment which is for an abstract type. We
should cut down our type selections based on the actual concrete type of
the field, to generate more specific raw_response types. We should also
mark the selections has having the same concrete type as our field,
preventing redundant arms of the final TypeScript/Flow union types from
being output.

This makes the output raw response types a lot more pleasant to work
with.

Fixes facebook#5090
@meta-cla
Copy link

meta-cla bot commented Oct 11, 2025

Hi @jwatzman!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@meta-cla meta-cla bot added the CLA Signed label Oct 11, 2025
@meta-cla
Copy link

meta-cla bot commented Oct 11, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@raw_response_type generates TypeScript types with duplicated union arms

2 participants