Skip to content
Closed
Changes from 1 commit
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
Prev Previous commit
Resolve ReactElement<unknown> breaking changes
The codemod affected 15 files while we only had to change a single file.
Confirms that this codemod should really be off by default.
Cautionary advise against it should be stronger.
  • Loading branch information
eps1lon committed Mar 21, 2024
commit 97fcba326ef465d134862feb1990f875d360675e
6 changes: 3 additions & 3 deletions packages/next/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getPolyfillScripts(context: HtmlProps, props: OriginProps) {
))
}

function hasComponentProps(child: any): child is React.ReactElement {
function hasComponentProps(child: any): child is React.ReactElement<any> {
return !!child && !!child.props
}

Expand All @@ -106,7 +106,7 @@ function AmpStyles({
if (!styles) return null

// try to parse styles from fragment for backwards compat
const curStyles: React.ReactElement[] = Array.isArray(styles)
const curStyles: React.ReactElement<any>[] = Array.isArray(styles)
? (styles as React.ReactElement[])
: []
if (
Expand All @@ -115,7 +115,7 @@ function AmpStyles({
// @ts-ignore Property 'props' does not exist on type ReactElement
Array.isArray(styles.props.children)
) {
const hasStyles = (el: React.ReactElement) =>
const hasStyles = (el: React.ReactElement<any>) =>
el?.props?.dangerouslySetInnerHTML?.__html
// @ts-ignore Property 'props' does not exist on type ReactElement
styles.props.children.forEach((child: React.ReactElement) => {
Expand Down