-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codemod: leave comment on spread props (#70979)
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...ransforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-27.input.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
interface Props { | ||
params: { | ||
slug: string; | ||
} | ||
} | ||
|
||
export function generateMetadata(props: Props, parent: any) { | ||
console.log({ ...parent }) | ||
} | ||
|
||
export default async function Page(props: Props) { | ||
const config = { ...props } | ||
return ( | ||
<Child {...props} {...config} /> | ||
) | ||
} | ||
|
||
export function GET(req, ctx) { | ||
console.log( | ||
{ ...ctx } | ||
) | ||
} | ||
|
||
export function POST(req, ctx) { | ||
console.log( | ||
{ ...req } | ||
) | ||
} |
31 changes: 31 additions & 0 deletions
31
...ansforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-27.output.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
interface Props { | ||
params: Promise<{ | ||
slug: string; | ||
}> | ||
} | ||
|
||
export function generateMetadata(props: Props, parent: any) { | ||
console.log({ ...parent }) | ||
} | ||
|
||
export default async function Page(props: Props) { | ||
const config = { /* Next.js Dynamic Async API Codemod: 'props' is used with spread syntax (...). Any asynchronous properties of 'props' must be awaited when accessed. */ | ||
...props } | ||
return ( | ||
(<Child /* Next.js Dynamic Async API Codemod: 'props' is used with spread syntax (...). Any asynchronous properties of 'props' must be awaited when accessed. */ | ||
{...props} {...config} />) | ||
); | ||
} | ||
|
||
export function GET(req, ctx) { | ||
console.log( | ||
{ /* Next.js Dynamic Async API Codemod: 'ctx' is used with spread syntax (...). Any asynchronous properties of 'ctx' must be awaited when accessed. */ | ||
...ctx } | ||
) | ||
} | ||
|
||
export function POST(req, ctx) { | ||
console.log( | ||
{ ...req } | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters