【发布时间】:2019-05-16 16:49:19
【问题描述】:
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
interface objInterface {
first: string;
second: string;
}
const obj = {
first: "first",
second: "second"
};
const out: Omit<objInterface, "first"> = obj;
我原以为这会有一些智能感知错误,但事实并非如此。但是,这确实显示了一些错误,有人知道为什么吗?
const out: Omit<objInterface, "first"> = {
first: 'first',
second: 'second'
};
【问题讨论】:
标签: typescript typescript-types