在ts-toolbelt的源代码中,经常存在空对象和映射类型的交集。这样做的目的是什么?
export type ReadonlyFlat<O> = {
+readonly [K in keyof O]: O[K];
} & {}; // there
export type OptionalFlat<O> = {
[K in keyof O]?: O[K];
} & {}; // there
type __Pick<O extends object, K extends keyof O> = {
[P in K]: O[P];
} & {}; // there
Run Code Online (Sandbox Code Playgroud)