roxiness / routify

Automated Svelte routes
https://routify.dev
1.85k stars 86 forks source link

RouteNode typescript error when using $route.path store #533

Open hobbitronics opened 8 months ago

hobbitronics commented 8 months ago

Describe the bug

I get the following error when using $route.path

Error: Property 'path' does not exist on type 'never'.
  The intersection 'RouteNode' was reduced to 'never' because property 'isFile' has conflicting types in some constituents. (ts)

Reproduction

do something like this

import { params } from '@roxi/routify'

$: customerIsOnAdminView = $route.path.includes('admin') && isCustomer($user.app_role)

Code works, but I get a ts error. I can just use location.pathname, but thought I'd let you know anyways.

Logs

Error: Property 'path' does not exist on type 'never'.
  The intersection 'RouteNode' was reduced to 'never' because property 'isFile' has conflicting types in some constituents. (ts)

System Info

"@roxi/routify": "^2.18.12",
    "svelte": "^3.55.1",
    "typescript": "^4.9.4"
    "@tsconfig/svelte": "^2.0.1",
macos 13.6 (22G120)