From c1003ebc393fd0864627d1937739fe2c25698628 Mon Sep 17 00:00:00 2001 From: Masahiko Shin Date: Mon, 29 Aug 2022 12:21:59 +0900 Subject: [PATCH 1/3] Fix CamelCaseKeys type. The T[P] in the type definition of CamelCaseKeys could be anything and did not always satisfy the constraint of the generics argument T. --- index.d.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/index.d.ts b/index.d.ts index f4ee3c3..53a393c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -45,16 +45,18 @@ export type CamelCaseKeys< > = T extends readonly any[] // Handle arrays or tuples. ? { + [P in keyof T]: T[P] extends Record | readonly any[] // eslint-disable-next-line @typescript-eslint/ban-types - [P in keyof T]: {} extends CamelCaseKeys - ? T[P] - : CamelCaseKeys< - T[P], - Deep, - IsPascalCase, - Exclude, - StopPaths - >; + ? {} extends CamelCaseKeys + ? T[P] + : CamelCaseKeys< + T[P], + Deep, + IsPascalCase, + Exclude, + StopPaths + > + : T[P]; } : T extends Record // Handle objects. From a303f62774f444b972ad23ae09efa6e9c9f4956f Mon Sep 17 00:00:00 2001 From: Masahiko Shin Date: Mon, 29 Aug 2022 12:16:48 +0900 Subject: [PATCH 2/3] update tsd to v0.23.0. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a1f9f49..e5a4897 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "devDependencies": { "ava": "^4.3.0", "matcha": "^0.7.0", - "tsd": "^0.20.0", + "tsd": "0.23.0", "xo": "^0.49.0" }, "xo": { From 4d386db34cdb6b11eeda2af1df17635ea33b2485 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 29 Aug 2022 12:15:09 +0700 Subject: [PATCH 3/3] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5a4897..c6a703f 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "devDependencies": { "ava": "^4.3.0", "matcha": "^0.7.0", - "tsd": "0.23.0", + "tsd": "^0.23.0", "xo": "^0.49.0" }, "xo": {