UNPKG

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