ctimmerm / axios-mock-adapter

Axios adapter that allows to easily mock requests
MIT License
3.44k stars 241 forks source link

Types are not exported except for RequestHandler #294

Open dprentis opened 3 years ago

dprentis commented 3 years ago

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: