Unverified Commit d62627ce authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

codemod: modify props types when arg is prop (#71516)

parent be717138
type PageProps = {
params: { slug: string }
}
export default function Page(props: PageProps) {
const params = props.params
return <p>child {params.slug}</p>
}
type PageProps = {
params: { slug: string }
}
export default async function Page(props: PageProps) {
const params = (await props.params)
return <p>child {params.slug}</p>
}
...@@ -414,6 +414,10 @@ export function transformDynamicProps( ...@@ -414,6 +414,10 @@ export function transformDynamicProps(
modified ||= awaited modified ||= awaited
} }
if (modified) {
modifyTypes(currentParam.typeAnnotation, propsIdentifier, root, j)
}
// cases of passing down `props` into any function // cases of passing down `props` into any function
// Page(props) { callback(props) } // Page(props) { callback(props) }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment