kitware-resonant / django-s3-file-field

A Django library for uploading files directly to AWS S3 or MinIO Storage from HTTP clients.
Apache License 2.0
36 stars 6 forks source link

JS client: latest `axios` version causes type errors #272

Open mvandenburgh opened 2 years ago

mvandenburgh commented 2 years ago

From the code for the S3FileFieldClient constructor:

/**
   * Create an S3FileFieldClient instance.
   *
   * @param options {S3FileFieldClientOptions} - A Object with all arguments.
   * @param options.baseUrl - The absolute URL to the Django server.
   * @param [options.apiConfig] - An axios configuration to use for Django API requests.
   *                              Can be extracted from an existing axios instance via `.defaults`.
   */

On the latest version of axios, axiosInstance.defaults returns an object of type AxiosDefaults instead of AxiosRequestConfig as it did before. This is a new type introduced in https://github.com/axios/axios/commit/94a93447992392441f1928dffc9f10529ecec417#diff-7aa4473ede4abd9ec099e87fec67fd57afafaf39e05d493ab4533acc38547eb8L151-R171 that slightly differs from AxiosRequestConfig. Since S3FileFieldClient expects apiConfig to be of type AxiosRequestConfig, using axiosInstance.defaults as the example specifies results in a type error.