- Use the spread operator with type inference:
export function cache<T extends (...args: any[]) => any, KeyType, ResultType, ErrorType>(
fn: T,
options: Partial<ICacheOptions<KeyType, ResultType, ErrorType>> = {}
): T {
const mergedOptions: ICacheOptions<KeyType, ResultType, ErrorType> = {