From 940f4b7912905523508ec15fadad8666e4b8c6cc Mon Sep 17 00:00:00 2001 From: Laurence Dougal Myers Date: Mon, 5 Jul 2021 04:17:53 +1000 Subject: [PATCH] fix(types): allow readonly arrays for data matcher in types (#2215) --- .gitignore | 1 + types/index.d.ts | 2 +- types/tests.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a63a7fa95..0f1860025 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .cache +.idea .nyc_output .vscode coverage diff --git a/types/index.d.ts b/types/index.d.ts index 9a81a905a..b0c26bd17 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -52,7 +52,7 @@ declare namespace nock { | RegExp | DataMatcherArray | DataMatcherMap - interface DataMatcherArray extends Array {} + interface DataMatcherArray extends ReadonlyArray {} interface DataMatcherMap { [key: string]: DataMatcher } diff --git a/types/tests.ts b/types/tests.ts index cfc870137..f241e0982 100644 --- a/types/tests.ts +++ b/types/tests.ts @@ -40,7 +40,7 @@ inst = scope.post(str, objWithUndefinedValue) inst = scope.post(str, str) inst = scope.post(str, strings) inst = scope.post(str, [num, str, regex]) -inst = scope.post(str, [num, num, num]) +inst = scope.post(str, [num, num, num] as const) inst = scope.post(str, regex) inst = scope.post(str, buffer) inst = scope.post(str, true) // $ExpectError