【发布时间】:2020-04-01 13:04:21
【问题描述】:
export const omit = <T, U extends keyof T>(obj: T, keys: U[]): Exclude<T, U> =>
Object.keys(obj).reduce(
(acc: any, curr: any) => (keys.includes(curr) ? acc : { ...acc, [curr]: obj[curr] }),
{}
);
收到一条错误消息,说明 TS7053: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'unknown'.
并且希望没有错误消息和正确键入的函数。
【问题讨论】:
标签: javascript typescript express typeorm