Variable throwRedactedConst
throwRedacted: (
template: string[] | TemplateStringsArray,
...args: any,
) => never = Fail
Type Declaration
- (template: string[] | TemplateStringsArray, ...args: any): never
Parameters
- template: string[] | TemplateStringsArray
- ...args: any
Returns never
Use as a template literal tag to create and throw an error in whose
messageunquoted substitution values (i.e., those that are not output from the quote function) may have been redacted into lossytypeofoutput 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;: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 asThe
rawproperty of an input template array is ignored, so a simple array of strings may be provided directly.