【发布时间】:2021-05-06 10:02:29
【问题描述】:
我导出一个函数,我将它传递给router.beforeEach:
export default function (route, from, next) {
log.debug(route.path)
if (!identity.state.authenticated) {
log.debug('redirecting to "login" view...')
next({ name: 'login' })
} else {
next()
}
}
但这会导致 3 个 TypeScript 错误:
TS7006: Parameter 'route' implicitly has an 'any' type. TS7006: Parameter 'from' implicitly has an 'any' type. TS7006: Parameter 'next' implicitly has an 'any' type.
什么类型最适合这些人?我可以让它们只是对象,但没有一些类型可以从vue 导入吗?
【问题讨论】:
标签: typescript vue.js vuejs3