出现这种情况的原因使用,声明的类型和当前的类型对应不上,比如Ref对象包裹的对象。

declare interface RoutesListState<T> {
  routesList: Array<T>
  setRoutesList: (data: Array<T>) => void
}
export const useRoutesList = defineStore('routesList', (): RoutesListState<RouteItem> => {
  const routesList = ref<Array<RouteItem>>([])
 
  function setRoutesList(data: Array<RouteItem>) {
    routesList.value = data
  }
 
  return {
    routesList,
    setRoutesList,
  }
})