Skip to content

Commit

Permalink
fix(typing): more precise typing for ssr api (#20564)
Browse files Browse the repository at this point in the history
* Update index.d.ts

* fix wrong type
  • Loading branch information
Austaras authored and LekoArts committed Jan 13, 2020
1 parent e459c13 commit b53ec9a
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions packages/gatsby/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,31 +703,32 @@ export interface CreateSchemaCustomizationArgs extends ParentSpanPluginArgs {
}

export interface PreRenderHTMLArgs extends NodePluginArgs {
getHeadComponents: any[]
replaceHeadComponents: Function
getPreBodyComponents: any[]
replacePreBodyComponents: Function
getPostBodyComponents: any[]
replacePostBodyComponents: Function
getHeadComponents: () => React.ReactNode[]
replaceHeadComponents: (comp: React.ReactNode[]) => void
getPreBodyComponents: () => React.ReactNode[]
replacePreBodyComponents: (comp: React.ReactNode[]) => void
getPostBodyComponents: () => React.ReactNode[]
replacePostBodyComponents: (comp: React.ReactNode[]) => void
}

type ReactProps<T extends Element> = React.DetailedHTMLProps<React.HTMLAttributes<T>, T>
export interface RenderBodyArgs extends NodePluginArgs {
pathname: string
setHeadComponents: Function
setHtmlAttributes: Function
setBodyAttributes: Function
setPreBodyComponents: Function
setPostBodyComponents: Function
setHeadComponents: (comp: React.ReactNode[]) => void
setHtmlAttributes: (attr: ReactProps<HTMLHtmlElement>) => void
setBodyAttributes: (attr: ReactProps<HTMLBodyElement>) => void
setPreBodyComponents: (comp: React.ReactNode[]) => void
setPostBodyComponents: (comp: React.ReactNode[]) => void
setBodyProps: Function
}

export interface ReplaceRendererArgs extends NodePluginArgs {
replaceBodyHTMLString: Function
setHeadComponents: Function
setHtmlAttributes: Function
setBodyAttributes: Function
setPreBodyComponents: Function
setPostBodyComponents: Function
replaceBodyHTMLString: (str: string) => void
setHeadComponents: (comp: React.ReactNode[]) => void
setHtmlAttributes: (attr: ReactProps<HTMLHtmlElement>) => void
setBodyAttributes: (attr: ReactProps<HTMLBodyElement>) => void
setPreBodyComponents: (comp: React.ReactNode[]) => void
setPostBodyComponents: (comp: React.ReactNode[]) => void
setBodyProps: Function
}

Expand Down

0 comments on commit b53ec9a

Please sign in to comment.