RestoreCompatibility
type RestoreCompatibility =
| {
ok: true;
path: readonly string[];
}
| {
incompatible: RestoreIncompatibility;
ok: false;
};
Defined in: packages/rxdb-plugin-working-tree/src/working-tree/restore-precheck.ts:142
预检结论。
Union Members
Type Literal
{
ok: true;
path: readonly string[];
}
ok
readonly ok: true;
整条路径都兼容
path
readonly path: readonly string[];
选定的重放路径,按重放顺序(HEAD 在前),不含目标节点自身
Type Literal
{
incompatible: RestoreIncompatibility;
ok: false;
}
incompatible
readonly incompatible: RestoreIncompatibility;
首个不兼容节点,见 RestoreIncompatibility
ok
readonly ok: false;
路径上有节点不兼容
Remarks
判别式联合而不是「两个可选字段」:后者拼出来的对象有四种取值,其中「既 ok 又带
incompatible」与「既不 ok 又什么都没带」两种没有意义,而调用点的 if 只会覆盖其中一种。
判别之后,那两种在编译期就不可表达。