remove list formatting
This commit is contained in:
parent
c7389ffdf0
commit
4742409b5b
1 changed files with 1 additions and 4 deletions
|
|
@ -801,13 +801,10 @@ function unique<T>(values: T[]): T[] {
|
|||
return Array.from(new Set(values));
|
||||
}
|
||||
|
||||
const andFormatter = new Intl.ListFormat('en', {style: 'long', type: 'conjunction'});
|
||||
const orFormatter = new Intl.ListFormat('en', {style: 'long', type: 'disjunction'});
|
||||
|
||||
function typeErrorMessageMultipleValues(expectedType: AssertionTypeDescription | AssertionTypeDescription[], values: unknown[]): string {
|
||||
const uniqueExpectedTypes = unique((isArray(expectedType) ? expectedType : [expectedType]).map(value => `\`${value}\``));
|
||||
const uniqueValueTypes = unique(values.map(value => `\`${is(value)}\``));
|
||||
return `Expected values which are ${orFormatter.format(uniqueExpectedTypes)}. Received values of type${uniqueValueTypes.length > 1 ? 's' : ''} ${andFormatter.format(uniqueValueTypes)}.`;
|
||||
return `Expected values which are ${uniqueExpectedTypes.join(", ")}. Received values of type${uniqueValueTypes.length > 1 ? 's' : ''} ${uniqueValueTypes.join(", ")}.`;
|
||||
}
|
||||
|
||||
// Type assertions have to be declared with an explicit type.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue