From 2ce1eb660bb39edf28b07b0c38fe4510c74ef859 Mon Sep 17 00:00:00 2001 From: Jason Pickens Date: Thu, 1 Feb 2024 12:07:01 +1300 Subject: [PATCH] fix: reproduce problem with params typing (#1057) --- test/Matcher.test.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/Matcher.test.ts b/test/Matcher.test.ts index 66d02a34..a887e06c 100644 --- a/test/Matcher.test.ts +++ b/test/Matcher.test.ts @@ -220,11 +220,15 @@ describe('Matcher', () => { }, ]); - expect( - matcher.match({ - pathname: '/a', - }), - ).toEqual({ + const missingMatch = matcher.match({ pathname: '/a' }); + + if (missingMatch != null && 0 in missingMatch.params) { + // FIXME: This type is wrong. It should be string | undefined. + const param: string = missingMatch.params[0]; + expect(param).toBeUndefined(); + } + + expect(missingMatch).toEqual({ routeIndices: [0, 0], routeParams: [{ foo: 'a' }, { 0: undefined }], params: {