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

Typescript generator as something configured in the compiler config.json #3181

Closed
maraisr opened this issue Sep 11, 2020 · 1 comment
Closed

Comments

@maraisr
Copy link
Contributor

maraisr commented Sep 11, 2020

Following on from #3180, this here is to track the progress and implementation of the Typescript relay-typegen initiative.

I think a good place to start looking is https://github.com/facebook/relay/tree/master/compiler/crates/relay-typegen/src

But @kassens if you don't mind dropping some notes (or even edit this issue) about where to go, what to do and some rough implementation guide. I'd be more than happy to tackle this, this weekend! (I know I've said this in the past, but got stuck pretty quick).

facebook-github-bot pushed a commit that referenced this issue Sep 17, 2020
Summary:
See #3181 and #3180.

This PR adds a language option to the typegen_config and refactors the relay-typegen crate to allow completely different output based on the configured language, currently typescript and flow (which is the default when no language is configured, or an invalid one is set).

I also made some changes so the watchman query looks for .ts files when using typescript, and the output files also use .ts as their extension.

This probably needs a bit more work before it's completely ready. Off the top of my head:

- [ ] In `relay-compiler/build_project/artifact_content.rs` some output is generated such as `flow` and a commented out `import type` statement? Those should probably be left out for Typescript.
- [x] Currently the language used for typegen is Typescript if the language in the config file is "typescript", and Flow otherwise. We should probably display an error if an invalid language is set, e.g. "typesrcipt".
- [ ] I was not able to actually test the compiler due to an error returned by Watchman: `failed to parse query: must use ["suffix", "suffixstring"]`, and I don't have a clue why. This error was already returned before I made the changes to look for .ts files when using Typescript.
- [ ] I did not at all look into `relay-lsp` and whether any changes are needed there for Typescript.

Looking forward to your feedback!

cc kassens josephsavona maraisr

Pull Request resolved: #3182

Reviewed By: tyao1

Differential Revision: D23670620

Pulled By: kassens

fbshipit-source-id: 0e3e9e6860c6701d934b406c895dc04bfb5b6322
@kassens
Copy link
Member

kassens commented Sep 23, 2020

This was resolved by ab5c96b, I'll try to add more details to the main issue how to run from OSS!

@kassens kassens closed this as completed Sep 23, 2020
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