You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constperformTagsIntersection2=(tags: string[],sql)=>{console.info(tags.length)returnsql};if(query.tags?.length){sql=sql.where((builder)=>performTagsIntersection(query.tags,builder));// 为什么这里会提示 Argument of type 'string[] | undefined' is not assignable to parameter of type 'string[]'.}}
因为 typescript 认为在执行 where 中的回调时, 可能 query.tags 已经发生了变化, 包括变成了 undefined
因为 typescript 认为在执行 where 中的回调时, 可能 query.tags 已经发生了变化, 包括变成了 undefined
比如如下情形:
The text was updated successfully, but these errors were encountered: