【发布时间】:2021-09-09 01:51:11
【问题描述】:
当我构建项目时,它显示为 2 个功能,请帮助我!!
第一个错误是:
Argument of type 'IFilmCard[] | undefined' is not assignable to parameter of type 'IFilmCard[]'.
Type 'undefined' is not assignable to type 'IFilmCard[]'
export function __filterFilms(crts: [string, string?], arr: IFilmCard[]) {
return __filterByGenre(crts[0], __filterByYear(crts[1], arr))
}
第二个错误是:
Argument of type 'IPersonCard[] | undefined' is not assignable to parameter of type 'IPersonCard[]'.Type 'undefined' is not assignable to type 'IPersonCard[]'
export function __filterPersons(crts: [string, string?], arr: IPersonCard[]) {
return __filterByCountry(crts[0], __filterByYearsPersons(crts[1], arr))
}
【问题讨论】:
-
在两个函数
arr: IFilmCard[] = []上设置一个空数组作为arr参数的默认值
标签: javascript typescript next.js