Skip to content

Commit 5f1c675

Browse files
webfansplzyyx990803
authored andcommitted
fix(compile-sfc): improve of named
1 parent 005667f commit 5f1c675

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/compiler-sfc/src/compileScript.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,9 +572,9 @@ export function compileScript(
572572
return `\n props: ${propsDecls} as unknown as undefined,`
573573
}
574574

575-
function genSetupPropsArgs(
575+
function genSetupPropsType(
576576
props: Record<string, PropTypeData>,
577-
propsArgs: string
577+
propsType: string
578578
) {
579579
const keys = Object.keys(props)
580580
if (!keys.length) {
@@ -594,12 +594,12 @@ export function compileScript(
594594
if (prop) {
595595
const { required } = props[key]
596596
if (!required) {
597-
propsArgs = propsArgs.replace(`${key}?`, key)
597+
propsType = propsType.replace(`${key}?`, key)
598598
}
599599
}
600600
}
601601
})
602-
return `: ${propsArgs}`
602+
return `: ${propsType}`
603603
}
604604

605605
// 1. process normal <script> first if it exists
@@ -1020,11 +1020,11 @@ export function compileScript(
10201020
// 9. finalize setup() argument signature
10211021
let args = `__props`
10221022
if (propsTypeDecl) {
1023-
const propsArgs = `${scriptSetup.content.slice(
1023+
const propsType = `${scriptSetup.content.slice(
10241024
propsTypeDecl.start!,
10251025
propsTypeDecl.end!
10261026
)}`
1027-
args += genSetupPropsArgs(typeDeclaredProps, propsArgs)
1027+
args += genSetupPropsType(typeDeclaredProps, propsType)
10281028
}
10291029
// inject user assignment of props
10301030
// we use a default __props so that template expressions referencing props

0 commit comments

Comments
 (0)