Skip to content

Commit e694ba8

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Use conditional type to power EntryPointElementConfig
Reviewed By: panagosg7 Differential Revision: D51694032 fbshipit-source-id: 928c7489736b2308288dff6e7ae88c060386716e
1 parent 1b65edd commit e694ba8

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

packages/react-relay/relay-hooks/EntryPointTypes.flow.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -214,24 +214,22 @@ export type PreloadedEntryPoint<TEntryPointComponent> = $ReadOnly<{
214214
rootModuleID: string,
215215
}>;
216216

217-
type _ComponentFromEntryPoint = <
218-
TPreloadParams,
219-
// $FlowFixMe[unsupported-variance-annotation]
220-
+TComponent,
221-
// $FlowFixMe[unsupported-variance-annotation]
222-
+TEntryPoint: EntryPoint<TPreloadParams, TComponent>,
223-
>(
224-
TEntryPoint,
225-
) => TComponent;
226-
227-
type ComponentFromEntryPoint<+TEntryPoint> = $Call<
228-
_ComponentFromEntryPoint,
229-
TEntryPoint,
230-
>;
231-
232-
export type EntryPointElementConfig<+TEntryPoint> = ElementConfig<
233-
ComponentFromEntryPoint<TEntryPoint>,
234-
>['props'];
217+
export type EntryPointElementConfig<
218+
// $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
219+
+TEntryPoint: InternalEntryPointRepresentation<any, any, any, any, any>,
220+
> = TEntryPoint extends InternalEntryPointRepresentation<
221+
// $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
222+
any,
223+
// $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
224+
any,
225+
// $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
226+
any,
227+
infer Props,
228+
// $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
229+
any,
230+
>
231+
? Props
232+
: empty;
235233

236234
export type ThinQueryParams<
237235
TQuery: OperationType,

0 commit comments

Comments
 (0)