axios-mock-adapter icon indicating copy to clipboard operation
axios-mock-adapter copied to clipboard

Types are not exported except for RequestHandler

Open dprentis opened this issue 4 years ago • 0 comments

Would be great to export other types defined in https://github.com/ctimmerm/axios-mock-adapter/blob/master/types/index.d.ts

This would make them directly accessible to the application. Currently I'm working around like this, but it's unnecessarily convoluted:

import MockAdapter from 'axios-mock-adapter';

// extract types
type RequestMatcherFunc = MockAdapter['onAny'];
type RequestMatcherFuncParams = Parameters<RequestMatcherFunc>;
type Matcher = RequestMatcherFuncParams[0];
type Body = RequestMatcherFuncParams[1];
type Headers = RequestMatcherFuncParams[2];

Otherwise a great library - thanks! :+1:

dprentis avatar Feb 05 '21 08:02 dprentis