@@ -126,37 +126,21 @@ Every .entrypoint file it's an object that must have two required fields:
126126TEntryPointParams - object that contains all necessary information to execute
127127the preloaders (routeParams, query variables)
128128
129- TPreloadedQueries - queries, defined in the root components
130-
131- TPreloadedEntryPoints - nested entry points, defined in the root components
132-
133- TRuntimeProps - the type of additional props that you may pass to the
134- component (like `onClick` handler, etc) during runtime. Values for them
135- defined during component runtime
136-
137- TExtraProps - a bag of extra props that you may define in `entrypoint` file
138- and they will be passed to the EntryPointComponent as `extraProps`
129+ TEntryPointComponent - the root components
139130*/
140- export type InternalEntryPointRepresentation <
131+ export type EntryPoint <
141132 - TEntryPointParams ,
142- TPreloadedQueries ,
143- TPreloadedEntryPoints = { ...} ,
144- TRuntimeProps = { ...} ,
145- TExtraProps = null ,
146- + TRenders : React . Node = React . Node ,
133+ // $FlowExpectedError[unclear-type] accepts any root component
134+ + TEntryPointComponent : EntryPointComponent < any , any , any , any , any > ,
147135> = $ReadOnly < {
148136 getPreloadProps : (
149137 entryPointParams : TEntryPointParams ,
150- ) => PreloadProps < TPreloadedQueries , TPreloadedEntryPoints, TExtraProps> ,
151- root : JSResourceReference <
152- EntryPointComponent <
153- TPreloadedQueries ,
154- TPreloadedEntryPoints,
155- TRuntimeProps,
156- TExtraProps,
157- TRenders,
158- > ,
138+ ) => PreloadProps <
139+ ElementConfig < TEntryPointComponent > [ 'queries' ] ,
140+ ElementConfig< TEntryPointComponent > [ 'entryPoints' ] ,
141+ ElementConfig < TEntryPointComponent > [ 'extraProps' ] ,
159142 > ,
143+ root : JSResourceReference < TEntryPointComponent > ,
160144} > ;
161145
162146// The shape of the props of the entry point `root` component
@@ -172,7 +156,23 @@ export type EntryPointProps<
172156 queries : TPreloadedQueries ,
173157} > ;
174158
175- // Type of the entry point `root` component
159+ /**
160+ Type of the entry point `root` component
161+
162+ TEntryPointParams - object that contains all necessary information to execute
163+ the preloaders (routeParams, query variables)
164+
165+ TPreloadedQueries - queries, defined in the root components
166+
167+ TPreloadedEntryPoints - nested entry points, defined in the root components
168+
169+ TRuntimeProps - the type of additional props that you may pass to the
170+ component (like `onClick` handler, etc) during runtime. Values for them
171+ defined during component runtime
172+
173+ TExtraProps - a bag of extra props that you may define in `entrypoint` file
174+ and they will be passed to the EntryPointComponent as `extraProps`
175+ */
176176export type EntryPointComponent <
177177 TPreloadedQueries ,
178178 TPreloadedEntryPoints = { } ,
@@ -215,21 +215,18 @@ export type PreloadedEntryPoint<TEntryPointComponent> = $ReadOnly<{
215215} > ;
216216
217217export type EntryPointElementConfig <
218- // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
219- + TEntryPoint : InternalEntryPointRepresentation < any , any , any , any , any > ,
220- > =
221- TEntryPoint extends InternalEntryPointRepresentation <
218+ + TEntryPoint : EntryPoint <
222219 // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
223220 any ,
224221 // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
225222 any ,
226- // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
227- any ,
228- infer Props ,
229- // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
230- any ,
223+ > ,
224+ > =
225+ TEntryPoint extends EntryPoint <
226+ infer _EntryPointParams ,
227+ infer EntryPointComponent ,
231228 >
232- ? Props
229+ ? ElementConfig < EntryPointComponent > [ 'props' ]
233230 : empty ;
234231
235232export type ThinQueryParams <
@@ -280,20 +277,10 @@ export type ExtractQueryTypes<
280277} ;
281278
282279// $FlowFixMe[unclear-type]: we don't care about the props
283- type Renders < + C : component ( ...any ) > =
280+ export type RootComponentRenders < + C : component ( ...any ) > =
284281 // $FlowFixMe[unclear-type]: we don't care about the props
285282 C extends component ( ...any ) renders infer R extends React . Node ? R : empty ;
286283
287- export type EntryPoint < - TEntryPointParams , + TEntryPointComponent > =
288- InternalEntryPointRepresentation <
289- TEntryPointParams ,
290- ElementConfig < TEntryPointComponent > [ 'queries' ] ,
291- ElementConfig < TEntryPointComponent > [ 'entryPoints' ] ,
292- ElementConfig < TEntryPointComponent > [ 'props' ] ,
293- ElementConfig < TEntryPointComponent > [ 'extraProps' ] ,
294- Renders < TEntryPointComponent > ,
295- > ;
296-
297284export type PreloadParamsOf < T > = Parameters < T [ 'getPreloadProps' ] > [ 0 ] ;
298285
299286export type IEnvironmentProvider < TOptions > = $ReadOnly < {
0 commit comments