Relay IDs and scalar types should be opaque types in flow
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Currently the flow types generated by relay use `string` type to represent the ID. The type for the ID field should be a flow opaque type so that users on cannot pass it arbitrary strings as IDs.
This behaviour should be extended for custom scalar types. I.e. Every scalar type should be a unique opaque type.
```
export type RestrictedPartyHitsPanelRestrictedPartyHitScanForCompanyMutationResponse = {|
+RestrictedPartyHitScanForCompany: ?{|
+company: ?{|
+id: string, // CAN THIS BE A an opaque type
....
```
Contributor guide
Research direction
No file or test path is named. Start at Relay's Flow type-generation entry point and trace how the shown ID and custom scalar fields are emitted; done means generated IDs and each scalar use distinct opaque types, with tests confirming arbitrary strings are rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100