Axios is throwing an error abortSignal during the build?

Viewed 406

I am trying to use axios in nodejs typescript project and during the build it is throwing an error abortSignal any fix for this issue appreciate the help

index.ts

export async function getAccessToken(apiConfig: any) {

        const req = {
            grant_type: apiConfig.authOptions.body.grant_type,
            client_id: apiConfig.authOptions.credentials.clientId,
            client_secret: apiConfig.authOptions.credentials.clientSecret,
            scope: apiConfig.authOptions.body.scope
        };
        const headers = {
            "Content-Type": "application/x-www-form-urlencoded",
            "appName": "Blink"
        };
        try {
            const resp: AxiosResponse = await axios.post('https://test.com//auth/oauth2/token',
            req, { headers });
            console.log(resp.data);
        } catch (err) {
            // Handle Error Here
            console.error(err);
        }
    }

Error

node_modules/axios/index.d.ts(93,12): error TS2304: Cannot find name 'AbortSignal'.

Package.json

"axios": "^0.24.0",
0 Answers
Related