Skip to content

Commit

Permalink
chore: fixed infer params when only numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
victorgarciaesgi committed Dec 4, 2023
1 parent e8d6805 commit 1d14022
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-typed-router",
"version": "3.4.0",
"version": "3.5.0-beta.0",
"description": "Provide autocompletion for routes paths, names and params in Nuxt apps",
"type": "module",
"main": "./dist/module.cjs",
Expand Down Expand Up @@ -60,7 +60,7 @@
"url": "https://github.com/victorgarciaesgi/nuxt-typed-router/issues"
},
"peerDependencies": {
"prettier": "^2.8.5 || 3.x"
"prettier": "^2.5.x || 3.x"
},
"dependencies": {
"@nuxt/kit": "3.8.2",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ export function createTypeValidatePathCondition(
const isLast = index === elements.flat().length - 1;
if (elem.type === 'name' && isLast) {
const id = pascalCase(elem.content);
const id = `T${pascalCase(elem.content)}`;
params.set(elem.id, id);
return `${elem.content}\${infer ${id}}`;
} else if (elem.type === 'name') {
return elem.content;
} else if (elem.type === 'param' || elem.type === 'optionalParam') {
const id = pascalCase(elem.content);
const id = `T${pascalCase(elem.content)}`;
params.set(elem.id, id);
return `\${infer ${id}}`;
} else if (elem.type === 'catchAll') {
Expand Down

0 comments on commit 1d14022

Please sign in to comment.