79779923

Date: 2025-10-01 10:39:05
Score: 0.5
Natty:
Report link

You can not get hello as the type from .toLowerCase() without a cast.

If you really want strict typing, the safest/idiomatic approach is:

const toLowerCaseTyped = <S extends string>(str: S) =>   
      str.toLowerCase() as Lowercase<S>;
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Kamran