diff --git a/types/ElementsRenderer.d.ts b/types/ElementsRenderer.d.ts new file mode 100644 index 00000000..8a7eb725 --- /dev/null +++ b/types/ElementsRenderer.d.ts @@ -0,0 +1,3 @@ +// TypeScript Version: 3.0 + +export { ElementsRenderer as default, ElementsRendererProps } from 'found'; diff --git a/types/createRender.d.ts b/types/createRender.d.ts index 0eb6355d..52921fc4 100644 --- a/types/createRender.d.ts +++ b/types/createRender.d.ts @@ -4,6 +4,7 @@ export { createRender as default, CreateRenderOptions, RenderArgs, + RenderArgsElements, RenderErrorArgs, RenderPendingArgs, RenderReadyArgs, diff --git a/types/index.d.ts b/types/index.d.ts index 18f4eee0..a7da3114 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -410,8 +410,13 @@ export function createMatchEnhancer( export type RenderPendingArgs = Match; +// This is the folded resolver output from resolveRenderArgs. +export type RenderArgsElements = Array< + ResolvedElement | Record +>; + export interface RenderReadyArgs extends Match { - elements: Array>; + elements: RenderArgsElements; } export interface RenderErrorArgs extends Match { @@ -496,6 +501,12 @@ export function createInitialBrowserRouter( options: InitialBrowserRouterOptions, ): Promise; +export interface ElementsRendererProps { + elements: RenderArgsElements; +} + +export type ElementsRenderer = React.ComponentType; + export interface GetStoreRenderArgsOptions { store: Store; getFound?: (store: Store) => FoundState;