Problem:
Currently, function composition manually chains interceptors, making it difficult to scale.
Proposed Solution:
Refactor function composition to use variadic tuple types for better flexibility and readability.
TypeScript Version Required: 5.7+
Example Fix (httpInterceptor.ts):
export function applyInterceptors<T>(
...interceptors: HttpInterceptorInterface<T>[]
): HttpCallExecutor<T> {
return (request, options, client) =>
interceptors.reduceRight(
(next, interceptor) => (req, opts) => interceptor(req, opts, next),
client
)(request, options);
}
Affected Files:
httpInterceptor.ts
apiLogger.ts
Expected Benefits:
- Reduces boilerplate code for chaining functions.
- Improves scalability by allowing flexible function composition.
Problem:
Currently, function composition manually chains interceptors, making it difficult to scale.
Proposed Solution:
Refactor function composition to use variadic tuple types for better flexibility and readability.
TypeScript Version Required: 5.7+
Example Fix (
httpInterceptor.ts):Affected Files:
httpInterceptor.tsapiLogger.tsExpected Benefits: