Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
d62627ce
Unverified
Commit
d62627ce
authored
Oct 19, 2024
by
Jiachi Liu
Committed by
GitHub
Oct 19, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
codemod: modify props types when arg is prop (#71516)
parent
be717138
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
access-props-38.input.tsx
...async-request-api-dynamic-props/access-props-38.input.tsx
+8
-0
access-props-38.output.tsx
...sync-request-api-dynamic-props/access-props-38.output.tsx
+8
-0
next-async-dynamic-prop.ts
...ansforms/lib/async-request-api/next-async-dynamic-prop.ts
+4
-0
No files found.
packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-38.input.tsx
0 → 100644
View file @
d62627ce
type
PageProps
=
{
params
:
{
slug
:
string
}
}
export
default
function
Page
(
props
:
PageProps
)
{
const
params
=
props
.
params
return
<
p
>
child
{
params
.
slug
}
</
p
>
}
packages/next-codemod/transforms/__testfixtures__/next-async-request-api-dynamic-props/access-props-38.output.tsx
0 → 100644
View file @
d62627ce
type
PageProps
=
{
params
:
{
slug
:
string
}
}
export
default
async
function
Page
(
props
:
PageProps
)
{
const
params
=
(
await
props
.
params
)
return
<
p
>
child
{
params
.
slug
}
</
p
>
}
packages/next-codemod/transforms/lib/async-request-api/next-async-dynamic-prop.ts
View file @
d62627ce
...
...
@@ -414,6 +414,10 @@ export function transformDynamicProps(
modified
||=
awaited
}
if
(
modified
)
{
modifyTypes
(
currentParam
.
typeAnnotation
,
propsIdentifier
,
root
,
j
)
}
// cases of passing down `props` into any function
// Page(props) { callback(props) }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment