lisaogren / axios-cache-adapter

Caching adapter for axios. Store request results in a configurable store to prevent unneeded network requests.
MIT License
725 stars 108 forks source link

fix: Change `methods` type to array of predefined strings #239

Closed antonkravc closed 3 years ago

antonkravc commented 3 years ago

I have my CI failing since the 2.7.1 release because of the type of methods.

node_modules/axios-cache-adapter/axios-cache-adapter.d.ts(77,15): error TS2314: Generic type 'Array<T>' requires 1 type argument(s).

At the very least the definition should be changed to Array<string> however I propose changing the type to an array of predefined strings. This solves the compilation issue as well as improves developer experience because the user now knows what the valid options are.

codecov[bot] commented 3 years ago

Codecov Report

Merging #239 (3cf876c) into master (2573d6e) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #239   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines          235       235           
=========================================
  Hits           235       235           

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update 2573d6e...e2de0b4. Read the comment docs.

ghost commented 3 years ago

Thank you! I do agree with your fix setting a list of predefined values. Sorry for breaking your CI 😞 Will merge and release this quickly.

ghost commented 3 years ago

Released https://github.com/RasCarlito/axios-cache-adapter/releases/tag/2.7.3 πŸ™‚

antonkravc commented 3 years ago

@RasCarlito Glad I could help. Would you be interested in converting your project to Typescript at some point? It will be much easier to spot issues like this and make your code more type safe in general. If you are interested I would be happy to help you with that.