toss / es-toolkit

A modern JavaScript utility library that's 2-3 times faster and up to 97% smaller—a major upgrade to lodash.
https://es-toolkit.slash.page
Other
6.66k stars 303 forks source link

Why does `lowerCase`'s type signature is so general? #172

Open KonradLinkowski opened 3 months ago

KonradLinkowski commented 3 months ago

Why does lowerCase's type signature looks like that:

function lowerCase(str: string): string;

When capitalize's looks like this:

function capitalize<T extends string>(str: T): Capitalize<T>;

Shouldn't it be:

function lowerCase<T extends string>(str: T): Lowercase<T>;

?

raon0211 commented 3 months ago

I guess we should match capitalize if possible.