Skip to content

Commit b4b4332

Browse files
committed
feat: warn possible bug
See #706
1 parent c1a99bf commit b4b4332

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/codegen/generateRouteParams.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ export function generateRouteParams(node: TreeNode, isRaw: boolean): string {
1111
const nodeParams = node.pathParams
1212
return nodeParams.length > 0
1313
? `{ ${nodeParams
14+
.filter((param) => {
15+
if (!param.paramName) {
16+
console.warn(
17+
`Warning: A parameter without a name was found in the route "${node.fullPath}" in segment "${node.path}".\n` +
18+
`‼️ This is a bug, please report it at https://github.com/posva/unplugin-vue-router`
19+
)
20+
return false
21+
}
22+
return true
23+
})
1424
.map(
1525
(param) =>
1626
`${param.paramName}${param.optional ? '?' : ''}: ` +

0 commit comments

Comments
 (0)