刚刚升级到角14,得到错误:
Types of property 'pathMatch' are incompatible.
Type 'string' is not assignable to type '"full" | "prefix"'.
从以下地点呼叫:
import { Routes as routes } from './routes';
@NgModule({
imports: [
RouterModule.forChild(routes)
]...})
有路线在
export const Routes = [
{
path: '',
redirectTo: '/signup',
pathMatch: 'full'
}]
整件事在十角形上运作得很好。有什么想法吗?
发布于 2022-10-08 21:47:18
您可以创建一个类型并将其转换为:
type PathMatch = "full" | "prefix" | undefined;
const routes = [
{
path: 'achievements',
component: AchievementOverviewComponent,
pathMatch: 'full' as PathMatch
}
]
更多信息,在一个相关的答案:Typescript Type 'string' is not assignable to type。
https://stackoverflow.com/questions/73964138
复制相似问题