最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

typescript - How to use the common Route type? - Stack Overflow

programmeradmin2浏览0评论
import type {Route} from "@tanstack/react-router";
import {Route as MeRoute} from '@/app/(start)/me/index.tsx'
import {Route as MessageRoute} from '@/app/(start)/message/index.tsx'

interface Item {
  label: string
  route: Route
}

const items: Item[] = [
  {
    label: "me",
    route: MeRoute
  },
  {
    label: "message",
    route: MessageRoute
  }
]

erorr message:

Types of property isRoot are incompatible.
Type false is not assignable to type true
Test. tsx(14, 3): The expected type comes from property route which is declared here on type Item

This doesn't seem to be the correct usage. I want to use the imported Route in other files to get the path. How should I do it?

发布评论

评论列表(0)

  1. 暂无评论