import type { InvokeMethod, InvokeMethodOptionalArgs } from "../client"; import type { GetOutputType } from "../command"; import type { DocumentType } from "../shapes"; /** * @public * * This type is intended as a type helper for generated clients. * When initializing client, cast it to this type by passing * the client constructor type as the type parameter. * * It will then recursively remove "undefined" as a union type from all * input and output shapes' members. Note, this does not affect * any member that is optional (?) such as outputs with no required members. * * @example * ```ts * const client = new Client({}) as AssertiveClient; * ``` */ export type AssertiveClient = NarrowClientIOTypes; /** * @public * * This is similar to AssertiveClient but additionally changes all * output types to (recursive) Required so as to bypass all output nullability guards. */ export type UncheckedClient = UncheckedClientOutputTypes; /** * @internal * * Excludes undefined recursively. */ export type NoUndefined = T extends Function ? T : T extends DocumentType ? T : [T] extends [object] ? { [key in keyof T]: NoUndefined; } : Exclude; /** * @internal * * Excludes undefined and optional recursively. */ export type RecursiveRequired = T extends Function ? T : T extends DocumentType ? T : [T] extends [object] ? { [key in keyof T]-?: RecursiveRequired; } : Exclude; /** * @internal * * Removes undefined from unions. */ type NarrowClientIOTypes = { [key in keyof ClientType]: [ClientType[key]] extends [ InvokeMethodOptionalArgs ] ? InvokeMethodOptionalArgs, NoUndefined> : [ClientType[key]] extends [InvokeMethod] ? InvokeMethod, NoUndefined> : ClientType[key]; } & { send(command: Command, options?: any): Promise>>; }; /** * @internal * * Removes undefined from unions and adds yolo output types. */ type UncheckedClientOutputTypes = { [key in keyof ClientType]: [ClientType[key]] extends [ InvokeMethodOptionalArgs ] ? InvokeMethodOptionalArgs, RecursiveRequired> : [ClientType[key]] extends [InvokeMethod] ? InvokeMethod, RecursiveRequired> : ClientType[key]; } & { send(command: Command, options?: any): Promise>>>; }; export {};