@Cards-TS
    Preparing search index...

    Interface Presenter

    Interface describing the different forms of questions that can be posed to the user over a variety of mediums

    interface Presenter {
        checkbox<
            T extends Presentable,
            ValidateParam extends Serializable = undefined,
        >(
            options: {
                choices: { name: string; value: T }[];
                message: Presentable[];
                validate?: (
                    input: T[],
                    param: ValidateParam,
                ) => string | true | Promise<string | true>;
                validateParam?: ValidateParam;
            },
        ): () => T[] | Promise<T[]>;
        confirm(
            options: { message: Presentable[] },
        ): () => boolean | Promise<boolean>;
        input<ValidateParam extends Serializable = undefined>(
            options: {
                message: Presentable[];
                validate?: (
                    input: string,
                    param: ValidateParam,
                ) => string | true | Promise<string | true>;
                validateParam?: ValidateParam;
            },
        ): () => string | Promise<string>;
        list<T extends Presentable>(
            options: {
                choices: { name: string; value: T }[];
                message: Presentable[];
            },
        ): () => T | Promise<T>;
        place<
            T extends Presentable,
            ValidateParam extends Serializable = undefined,
        >(
            options: {
                choices: { name: string; value: T }[];
                message: Presentable[];
                placeholder: string;
                validate?: (
                    input: number,
                    param: ValidateParam,
                ) => string | true | Promise<string | true>;
                validateParam?: ValidateParam;
            },
        ): () => number | Promise<number>;
        print(options: { message: undefined | Presentable[] }): () => void;
        printCards(options: { cards: Card[] }): () => Card[] | Promise<Card[]>;
    }

    Implemented by

    Index

    Methods

    • Allow the user to select multiple or no options from a list

      The validator function passed must not use any closure variables to work properly over a serialized interface

      Type Parameters

      Parameters

      • options: {
            choices: { name: string; value: T }[];
            message: Presentable[];
            validate?: (
                input: T[],
                param: ValidateParam,
            ) => string | true | Promise<string | true>;
            validateParam?: ValidateParam;
        }

        the options to pass

      Returns () => T[] | Promise<T[]>

    • Allow a user to input a text string of their choice

      The validator function passed must not use any closure variables to work properly over a serialized interface

      Type Parameters

      Parameters

      • options: {
            message: Presentable[];
            validate?: (
                input: string,
                param: ValidateParam,
            ) => string | true | Promise<string | true>;
            validateParam?: ValidateParam;
        }

        the options to pass

      Returns () => string | Promise<string>

    • Allow a user to decide wherein a list to place an item

      The validator function passed must not use any closure variables to work properly over a serialized interface

      Type Parameters

      Parameters

      • options: {
            choices: { name: string; value: T }[];
            message: Presentable[];
            placeholder: string;
            validate?: (
                input: number,
                param: ValidateParam,
            ) => string | true | Promise<string | true>;
            validateParam?: ValidateParam;
        }

        the options to pass

      Returns () => number | Promise<number>