UNPKG

907 BTypeScriptView Raw
1export declare type PropOr<T extends object | undefined, P extends string | symbol | number, D = undefined> = T extends Partial<Record<P, unknown>> ? T[P] : D;
2export declare type UnionKeys<T> = T extends unknown ? keyof T : never;
3declare type AddOptionalKeys<K extends PropertyKey> = {
4 readonly [P in K]?: undefined;
5};
6/**
7 * @see https://millsp.github.io/ts-toolbelt/modules/union_strict.html
8 */
9export declare type Deunionize<B extends object | undefined, T extends B = B> = T extends object ? T & AddOptionalKeys<Exclude<UnionKeys<B>, keyof T>> : T;
10/**
11 * Expose properties from all union variants.
12 * @see https://github.com/telegraf/telegraf/issues/1388#issuecomment-791573609
13 * @see https://millsp.github.io/ts-toolbelt/modules/union_strict.html
14 */
15export declare function deunionize<T extends object | undefined>(t: T): Deunionize<T, T>;
16export {};
17//# sourceMappingURL=deunionize.d.ts.map
\No newline at end of file