Home > other >  Cannot read properties of undefined (reading 'Ok') Axios
Cannot read properties of undefined (reading 'Ok') Axios

Time:10-15

I believe there a missing thing from my point but I try to invoke HttpStatusCode.Ok from Axios Enum The way I implement is

import { HttpStatusCode } from 'axios'

console.log(HttpStatusCode.Ok)

But I get weird error which is Cannot read properties of undefined (reading 'Ok')

CodePudding user response:

I'm fairly certain this is a bug in the just introduced HttpStatusCodes enum (the PR adding it was only 16 days ago), see this issue I've filed for it. The PR added the enum to index.d.ts, but didn't add the runtime aspect of the enum to lib/axios.js (since enums aren't just type information, they have a runtime aspect as well).

Presumably it'll get fixed in short order.

  • Related