【发布时间】:2020-05-26 15:56:41
【问题描述】:
我见过用于 Typescript 接口的按位运算符。谁能在这里描述它的含义:
interface RowGroup {
__metaData: RowGroupMetaData;
}
interface RowData {
id: number;
task: string;
complete: number;
priority: string;
issueType: string;
}
type GridRow = RowGroup | RowData; //**** THIS LINE
【问题讨论】:
-
不是按位或,而是union type
-
据我记得这是一个联合。这意味着在函数中传递 GridRow 的对象时,它可以是 RowGroup 也可以是 RowData
标签: javascript typescript