From 00b13f8b8a97e17ccfad759ebfb056f019eb0414 Mon Sep 17 00:00:00 2001 From: Ray Wong Date: Mon, 26 Dec 2022 08:02:05 +0900 Subject: [PATCH] `CamelCase`: Fix handling of non-literal strings (#531) --- source/camel-case.d.ts | 4 +++- test-d/camel-case.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/camel-case.d.ts b/source/camel-case.d.ts index cdc5aa229..76722861d 100644 --- a/source/camel-case.d.ts +++ b/source/camel-case.d.ts @@ -74,5 +74,7 @@ const dbResult: CamelCasedProperties = { @category Template literal */ export type CamelCase = Type extends string - ? Uncapitalize ? Lowercase : Type>, Options>> + ? string extends Type + ? Type + : Uncapitalize ? Lowercase : Type>, Options>> : Type; diff --git a/test-d/camel-case.ts b/test-d/camel-case.ts index e866ad76e..675a34946 100644 --- a/test-d/camel-case.ts +++ b/test-d/camel-case.ts @@ -75,3 +75,6 @@ expectType>('fooBa expectType>('fooBARBizBUZZ'); expectType>('fooBarBizBuzz'); + +expectType>('string' as string); +expectType>('string' as string);