facebook / facebook/relay

[Types] PageInfo types are incorrect (should be read-only)

Open
#3,780 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Issue**
The types for `PageInfo` under [ConnectionInterface](https://github.com/facebook/relay/blob/main/packages/relay-runtime/handlers/connection/ConnectionInterface.js#L25) should be read-only.

**Example**
`ConnectionInterface.js` they are writable
```
export type PageInfo = {
endCursor: ?string,
hasNextPage: boolean,
hasPreviousPage: boolean,
startCursor: ?string,
...
};
```
But if you run the relay compiler and generate types, the `PageInfo` for those types is read-only:
```
+pageInfo: {|
+startCursor: ?string,
+hasNextPage: boolean,
+endCursor: ?string,
|},
```
Any suggestions for how we should fix this? At the moment, we simply set those types ourselves.

Thank you for the help,

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.