EndoJS
    Preparing search index...

    Variable throwRedactedConst

    throwRedacted: (
        template: string[] | TemplateStringsArray,
        ...args: any,
    ) => never = Fail

    Type Declaration

      • (template: string[] | TemplateStringsArray, ...args: any): never
      • Use as a template literal tag to create and throw an error in whose message unquoted substitution values (i.e., those that are not output from the quote function) may have been redacted into lossy typeof output but are still available for logging to an associated console.

        For example, using the normal convention to locally rename properties like const { quote: q, Fail } = assert;:

        sky.isBlue() || Fail`${sky.color} should be "blue"`;
        

        This || pattern saves the cost of creating DetailsToken and/or error instances when the asserted condition holds, but can weaken TypeScript static reasoning due to https://github.com/microsoft/TypeScript/issues/51426 . Where this is a problem, instead express the assertion as

        if (!sky.isBlue()) {
        // This `throw` does not affect runtime behavior since `Fail` throws, but
        // might be needed to improve static analysis.
        throw Fail`${sky.color} should be "blue"`;
        }

        The raw property of an input template array is ignored, so a simple array of strings may be provided directly.

        Parameters

        • template: string[] | TemplateStringsArray
        • ...args: any

        Returns never