Skip to content

toCamelCaseKeys has wrong type for single word keys in screaming snake case #1537

@qadzek

Description

@qadzek

The runtime conversion works fine, but there is a type issue for keys that consist of a single word in SCREAMING_SNAKE_CASE. In the following example, LAST is converted to lAST.

I'm using version 1.42.0 of es-toolkit.

import { toCamelCaseKeys } from 'es-toolkit';

const obj = {
  FIRST_NAME: 'John',
  LAST: 'Doe',
};

const camelCasedObj = toCamelCaseKeys(obj);

console.log(camelCasedObj);
// Output: { firstName: "John", last: "Doe" }
// Type:   { firstName: string; lAST: string; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions