Skip to content

[WIP] Refactoring of the type generation/type assertion for provided variables to support internal use case with shared artifacts. #4429

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alunyov
Copy link
Contributor

@alunyov alunyov commented Aug 30, 2023

Differential Revision: D48801823

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48801823

@alunyov alunyov changed the title Refactoring of the type generation/type assertion for provided variables to support internal use case with shared artifacts. [WIP] Refactoring of the type generation/type assertion for provided variables to support internal use case with shared artifacts. Aug 30, 2023
@facebook-github-bot
Copy link
Contributor

@alunyov has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48801823

alunyov added a commit to alunyov/relay that referenced this pull request Aug 30, 2023
…les to support internal use case with shared artifacts. (facebook#4429)

Summary: Pull Request resolved: facebook#4429

Differential Revision: D48801823

Pulled By: alunyov

fbshipit-source-id: bcfd9ee731f9314f46d0ccb6953d1e8015c2bda9
@facebook-github-bot
Copy link
Contributor

@alunyov has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48801823

alunyov added a commit to alunyov/relay that referenced this pull request Aug 30, 2023
…les to support internal use case with shared artifacts. (facebook#4429)

Summary: Pull Request resolved: facebook#4429

Differential Revision: D48801823

Pulled By: alunyov

fbshipit-source-id: 91f7249105ac90652d8c257954dfcc4fa87467af
@facebook-github-bot
Copy link
Contributor

@alunyov has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

…les to support internal use case with shared artifacts. (facebook#4429)

Summary:
The main goal is to separate `codegen` and `typegen` for provided variables. Currently, there is an implicit dependency between `typegen` and `codegen` where were generating code for provided variables. The `codegen` expects the local type for provided variables to always be generated as `type ProvidedVariables` so we cam enable inline type assertion as

```
var providedVariables: ProvidedVariables = { ... object  with provided variables ... }
```

However, this approach doesn't work well with the `skip_types` option, where the `typegen` block for an operation is completely skipped (without the `skip_types` we would generate a type for `ProvidedVariables` in it), but the type inline assertion still remains in the `relay-codegen`.

The proposed solution is to make this dependency explicit by passing the generated provided variables object to the method responsible for generating types. Additionally, the type assertion should only be generated in the `relay-typegen`.

 ---
Pull Request resolved: facebook#4429

Test Plan: TBD

Differential Revision: D48801823

Pulled By: alunyov

fbshipit-source-id: 556098bb2ad2457d451b5e77bc38fdb568df2d08
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D48801823

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.

2 participants