Open serjo96 opened 2 years ago
// @g-plane
I think as const
is required.
(add as const
, then your ['iso_639_1', 'iso_3166_1']
can be of type ['iso_639_1', 'iso_3166_1']
, rather than string[]
)
Refer to: https://github.com/sindresorhus/camelcase-keys/blob/v8.0.2/index.test-d.ts#L84
TS reference : https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions
I have class with types for my object and I using convert to camel case like that with exclude keys:
camelcaseKeys(data, { exclude: ['iso_639_1', 'iso_3166_1'], deep: true });
Data after formatting camelcaseKeys is normal, but ts see like iso keys on camel cases to iso6391.![image](https://user-images.githubusercontent.com/17907946/149676076-5813727b-b08d-4bca-b45b-d2302c65ef5c.png)
Maybe add some generic only for return type, not only one generic for input and return type?![image](https://user-images.githubusercontent.com/17907946/149676374-ee2fa832-940e-4622-9241-91006661ffd2.png)