I have looked at several other StackOverflow questions about this error message and none of them solved my problem.
I have the following two lines in a TypeScript file, trying to import some vanilla JS:
import axios from 'utils/UserSessionAPIAxios';
axios.doStuff(stringArgument);
This is my *.d.ts
file:
declare module 'utils/UserSessionAPIAxios' {
export const someData: string;
export type DoStuffFn = (data: string) => void;
export default interface UserSessionAPIAxios {
doStuff: DoStuffFn;
}
}
The corresponding JS file looks like this:
import axios from 'axios';
export const someData = 'data data data';
const userSessionAxios = axios;
userSessionAxios.doStuff = (data) => {
// omitted
};
export default userSessionAxios;
Why am I getting the error axios only refers to a type, but is being used as a value here
on the line where I'm calling doStuff
?