From 4742409b5b257c272711419e6ad5d0fa8753e2c3 Mon Sep 17 00:00:00 2001 From: Duc Anh Phi <> Date: Tue, 22 Aug 2023 17:52:48 +0200 Subject: [PATCH] remove list formatting --- source/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/index.ts b/source/index.ts index 782a067..284a16d 100644 --- a/source/index.ts +++ b/source/index.ts @@ -801,13 +801,10 @@ function unique(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.