-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Missing TS type definition for relay config #4348
Comments
We did have a contribution to our types to add this, but was abandoned. I'll raise a PR to fix this. Sorry about that, that PR snuck through and didnt notice. Wondering though, would you @captbaritone be open to have this config file included in the |
I love the idea, and this is something I would love for us to have. That said, I think there is at least one questions we should answer first: How can we ensure the types file gets updated every time the compiler itself gets updated? |
Yeah I think there is a bigger story here with typescript in general, but at least for today — perhaps we can use the existing config types to codegen the typescript types? If you have ideas, happy yo PoC it. |
To his two flies in one hit than also upload a JSON schema to https://www.schemastore.org/json/ to make VSCode and a bunch of editors autocomplete it. Maybe promote a name for that json config like |
{
"$schema": "https://github.com/facebook/relay/raw/9f314a080274960ccd9257b66c47b3c6f3d74956/compiler/relay-compiler-config-schema.json",
// ...
}
It's released, and it works, and you can also do this: {
"$schema": "./node_modules/relay-compiler/relay-compiler-config-schema.json",
// ...
} |
Fixed by #4724 |
The original issue isn't really solved though, right? You now have support for JSON files, but if you're using the JS config loader you still don't have any TypeScript types (unless you generate them yourself based on the JSON schema) |
@tobias-tengler you're right, sorry for closing this. It still makes sense to provide something at the Relay land for JS configs. |
Jest offer users typed definitions for their config files:
As explained in their docs, you can write your docs in JS and use JSDocs to get type inference. Another approach is to write the config file in TS and directly import the
Config
type.Would the Relay team consider offering something similar? It would improve the DX when configuring the compiler. The current approach requires me to open the
relay-compiler
README to manually ensure I'm using the right options.The text was updated successfully, but these errors were encountered: