[relay] Make sure optional props remain optional.

This commit is contained in:
Eloy Durán
2018-02-06 15:51:49 +01:00
parent 4a5279010a
commit 26b18f911e
2 changed files with 6 additions and 1 deletions

View File

@@ -21,8 +21,10 @@ import * as RelayRuntimeTypes from "relay-runtime";
// ~~~~~~~~~~~~~~~~~~~~~
// Utility types
// ~~~~~~~~~~~~~~~~~~~~~
// Taken from https://github.com/pelotom/type-zoo
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
type Omit<T, K extends keyof T> = { [P in Diff<keyof T, K>]: T[P] };
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
type RemoveRelayProp<P> = Omit<P & { relay: never }, "relay">;

View File

@@ -75,6 +75,7 @@ const Story = (() => {
relay: RelayRefetchProp;
story: Story_story;
onLike: StoryLike;
ignoreMe?: {};
}
interface State {
@@ -161,6 +162,7 @@ const Feed = (() => {
relay: RelayProp;
feed: FeedStories_feed;
onStoryLike: StoryLike;
ignoreMe?: {};
}
const FeedStories: React.SFC<Props> = ({ feed, onStoryLike, relay }) => {
@@ -223,6 +225,7 @@ type UserFeed_user = {
relay: RelayPaginationProp;
loadMoreTitle: string;
user: UserFeed_user;
ignoreMe?: {};
}
class UserFeed extends React.Component<Props> {