types: 添加 Exclusive 类型互斥语法糖

This commit is contained in:
xiaoxian521 2023-05-13 19:39:16 +08:00
parent 1aba27590f
commit 5f3210f69e

4
types/index.d.ts vendored
View File

@ -41,6 +41,10 @@ type DeepPartial<T> = {
[P in keyof T]?: DeepPartial<T[P]>;
};
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
type Exclusive<T, U> = (Without<T, U> & U) | (Without<U, T> & T);
type TimeoutHandle = ReturnType<typeof setTimeout>;
type IntervalHandle = ReturnType<typeof setInterval>;