Currently, I am developing an application using the Quasar Framework in conjunction with Vue 3 and TypeScript, specifically utilizing the Composition API. My objective is to incorporate a Navigation Guard within my routes.ts file for handling route authentication. However, during this process, I've encountered the following error:
ERROR in src/router/index.ts:26:5
TS2740: Type 'Router' is missing the following properties from type 'readonly RouteRecordRaw[]': length, concat, join, slice, and 16 more.
24 | const Router = createRouter({
25 | scrollBehavior: () => ({ left: 0, top: 0 }),
> 26 | routes,
| ^^^^^^
27 |
28 | // Leave this as is and make changes in quasar.conf.js instead!
29 | // quasar.conf.js -> build -> vueRouterMode
Here are the steps I have taken so far:
- I initially followed the standard Vue 3 documentation to set up the Navigation Guard.
- Upon encountering the error, I tried modifying the vueRouterMode in the quasar.config.js file to 'history' from 'hash', based on recommendations from various forums.
- I also double-checked for any typos or misconfigurations in my code and ensured that all dependencies are up to date.
- Despite these efforts, the error persists, even though I anticipated that changing the vueRouterMode or reviewing the code for errors would resolve the issue.
routes.ts
...
auth-store.ts
...
src/router/index.ts
...