Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(typing): more precise typing for ssr api #20564

Merged
merged 2 commits into from
Jan 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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