If I have a function which has a return type involving an inferred generic type, the defaults on the call to the camelCaseKeys function return type incorrectly resolve to unknown:
export function handleResponse<T extends Record<string, unknown> | readonly unknown[]>(
response: T,
): CamelCaseKeys<T, true> {
return camelcaseKeys(response.data, { deep: true });
//^^^^^^ Type 'CamelCaseKeys<T, true, unknown, unknown, unknown, unknown, "">' is not assignable to type 'CamelCaseKeys<T, true>'
}
I expect the defaults to correctly resolve, as they do in the return type of my handleResponse function: CamelCaseKeys<T, true>.
If I have a function which has a return type involving an inferred generic type, the defaults on the call to the
camelCaseKeys
function return type incorrectly resolve tounknown
:I expect the defaults to correctly resolve, as they do in the return type of my
handleResponse
function:CamelCaseKeys<T, true>
.