From aa2662013e422680b411bf5cb79907a490105b9c Mon Sep 17 00:00:00 2001 From: Rafael Wendel <44540213+rafawendel@users.noreply.github.com> Date: Fri, 21 Jun 2024 17:40:44 -0300 Subject: [PATCH] Make types for capitalize infer format for constant strings This PR improves the types of `capitalize` on `string.ts` --- src/string.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string.ts b/src/string.ts index 40de090d..6ff0a1a0 100644 --- a/src/string.ts +++ b/src/string.ts @@ -4,7 +4,7 @@ * capitalize('hello') -> 'Hello' * capitalize('va va voom') -> 'Va va voom' */ -export const capitalize = (str: string): string => { +export const capitalize = (str: Str): Capitalize => { if (!str || str.length === 0) return '' const lower = str.toLowerCase() return lower.substring(0, 1).toUpperCase() + lower.substring(1, lower.length)