0

As per the title, I'm trying to create an axios http service which implements an http interface. Here is the short example:

import axios from 'axios';

interface IHttpService {
  get<T>(url: string, config?: object): Promise<T>;
}

class AxiosHttpService implements IHttpService {
  async get<T>(url: string, config: object = {}): Promise<T> {
    const response = await axios.get(url, config);
    return response.data;
  }
}

export default AxiosHttpService;

However I get the following error by es-lint:

Expected 'this' to be used by class async method 'get'.

Is there something inherintly wrong with how I'm implementing this?

james
  • 550
  • 8
  • 14

0 Answers0