CollectorValueType: T extends | { type: "PasswordCollector" }
| { type: "ValidatedPasswordCollector" }
| { type: "SingleSelectCollector" }
| { type: "DeviceRegistrationCollector" }
| { type: "DeviceAuthenticationCollector" }
| { type: "ProtectCollector" }
| { type: "PollingCollector" }
    ? string
    : T extends { category: "SingleValueCollector"; type: "TextCollector" }
        ? string
        : T extends {
            category: "ValidatedSingleValueCollector";
            type: "TextCollector";
        }
            ? string
            : T extends | { type: "BooleanCollector" }
            | { type: "ValidatedBooleanCollector" }
                ? boolean
                : T extends { type: "MultiSelectCollector" }
                    ? string[]
                    : T extends { type: "PhoneNumberCollector" }
                        ? PhoneNumberInputValue
                        : T extends { type: "PhoneNumberExtensionCollector" }
                            ? PhoneNumberExtensionInputValue
                            : T extends { type: "FidoRegistrationCollector" }
                                ? FidoRegistrationInputValue
                                : T extends { type: "FidoAuthenticationCollector" }
                                    ? FidoAuthenticationInputValue
                                    : T extends { category: ... }
                                        ? string
                                        : (...) extends (...) ? (...) : (...)

Maps collector types to the specific value type they accept. This enables type narrowing when using the update method with specific collector types.

Type Parameters

  • T
if (collector.type === "PasswordCollector") {
const updater = davinciClient.update(collector);
// updater now only accepts: (value: string, index?: number) => ...
}