sindresorhus / camelcase-keys

Convert object keys to camel case
MIT License
689 stars 92 forks source link

When using an opaque type the result type is wrong #87

Open valkum opened 2 years ago

valkum commented 2 years ago

When using type-fest Opaque or any other readonly symbol tag to get an opaque type, the result

type O = Opaque<string, "O">
type X = {partner_id: O};

ReturnType<typeof camelcaseKeys<X>>>

// Expected
// D: {partnerId: O}

// Actual
// D: {partnerId: {char_at, .....}}

It seems all functions for strings are also added to the return type instead of passing along the opaque type if it is a primitive.

sindresorhus commented 2 years ago

// @g-plane