From f2863e0339333e965716c9fc559852f303113861 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 20 Jul 2020 16:28:53 +0300 Subject: [PATCH] Added 'type checking' tests --- test/test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/test.ts b/test/test.ts index 44cd22a..16e376c 100644 --- a/test/test.ts +++ b/test/test.ts @@ -652,6 +652,19 @@ test('is.array', t => { t.throws(() => { assert.array([1, '2'], assert.number); }); + + t.notThrows(() => { + const x: unknown[] = [1, 2, 3]; + assert.array(x, assert.number); + x[0].toFixed(0); + }); + + t.notThrows(() => { + const x: unknown[] = [1, 2, 3]; + if (is.array(x, is.number)) { + x[0].toFixed(0); + } + }); }); test('is.function', t => {