From 3b5e92808c6ea2784559c1163b1c538180ee852a Mon Sep 17 00:00:00 2001 From: Ben Thompson <113354590+BenGearset@users.noreply.github.com> Date: Thu, 27 Apr 2023 10:51:36 +0100 Subject: [PATCH 1/3] Add `ReadonlyArray` to `Argument` --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 3a30112..39ff58d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -12,7 +12,7 @@ declare namespace classNames { type Value = string | number | boolean | undefined | null; type Mapping = Record; interface ArgumentArray extends Array {} - type Argument = Value | Mapping | ArgumentArray; + type Argument = Value | Mapping | ArgumentArray | ReadonlyArray; } interface ClassNames { From 342b9797febab153edb0185f68d651153c1e7fb8 Mon Sep 17 00:00:00 2001 From: Ben Thompson <113354590+BenGearset@users.noreply.github.com> Date: Thu, 27 Apr 2023 11:06:03 +0100 Subject: [PATCH 2/3] Add test --- tests/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/types.ts b/tests/types.ts index be8c2c0..b192580 100644 --- a/tests/types.ts +++ b/tests/types.ts @@ -20,6 +20,7 @@ classNames('bar', null, undefined, true, false, 1234); classNames('bar', ['abc', { foo: true }]); classNames('bar', ['abc', { foo: true }], { def: false, ijk: 1234 }); classNames('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }]); +classNames('abc', 1234, true, false, undefined, null, { foo: true }, ['abc', 1234, true, false, undefined, null, { foo: true }], ['abc', 1234, true, false, undefined, null, { foo: true }] as const); // $ExpectError classNames(Symbol()); // $ExpectError From ee8f9d8ddfb0259ea808d3497a3e2808957b0cca Mon Sep 17 00:00:00 2001 From: Ben Thompson <113354590+BenGearset@users.noreply.github.com> Date: Thu, 27 Apr 2023 11:08:08 +0100 Subject: [PATCH 3/3] Move to seperate interface for ; interface ArgumentArray extends Array {} - type Argument = Value | Mapping | ArgumentArray | ReadonlyArray; + interface ReadonlyArgumentArray extends ReadonlyArray {} + type Argument = Value | Mapping | ArgumentArray | ReadonlyArgumentArray; } interface ClassNames {