import { mtp, tl } from '@mtcute/tl'; export declare function isPresent(t: T | undefined | null | void): t is T; /** * Returns a function that can be used to filter down objects * to the ones that have a specific value V under a key `k`. * * @example * ```ts * type File = { type: "image", imageUrl: string } | { type: "pdf", pdfUrl: string }; * const files: File[] = []; * * const imageFiles = files.filter(file => file.type === "image"); * files[0].type // In this case, TS will still treat it as `"image" | "pdf"` * * const filesWithUrl = files.filter(hasValueKey("type", "image" as const)); * files[0].type // TS will now know that this is "image" * files[0].imageUrl // TS will know this is present, because already it excluded the other union members. * ``` */ export declare function hasValueAtKey(k: K, v: V): (a: T & { [k in K]: unknown; }) => a is T & { [k in K]: V; }; export declare function assertTypeIs(context: string, obj: T, expected: K): asserts obj is tl.FindByName; export declare function assertTypeIsNot(context: string, obj: T, expectedNot: K): asserts obj is Exclude>; export declare function mtpAssertTypeIs(context: string, obj: T, expected: K): asserts obj is mtp.FindByName; export declare function assertTrue(context: string, cond: boolean): asserts cond; export declare function isTlRpcError(obj: unknown): obj is mtp.RawMt_rpc_error;