Property 'get' does not exist on type 'typeof Axios'.
See original GitHub issueWhan I use axios with TypeScript, I got this error
Property 'get' does not exist on type 'typeof Axios'.
I tried some solutions like here but I still get above error
And my code is like this
import React from 'react'
import axios from "axios";
class Home extends React.Component {
constructor(props:any) {
super(props)
}
componentDidMount() {
axios.get("url").then((res:any) => console.log(res,"res"))
}
render() {
return <SomeComponents/>
}
}
export default Home
Any Solution?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9
Top Results From Across the Web
Property 'create' does not exist on type - Stack Overflow
I am trying to contact an API but when I use axios.create() I get an error saying: Property 'create' does not exist on...
Read more >property 'get' does not exist on type 'typeof axios' - You.com
Hello, i work with Angular, and i want to use axios to work with but the get function "does not exist". My code...
Read more >Property 'create' does not exist on type 'typeof import("/Users ...
While converting existing project to TS I'm getting an error: Property 'create' does not exist on type 'typeof import("/Users/my-path/node_ ...
Read more >关于Property 'create' does not exist on type 'typeof ... - 博客园
在 Vue 项目中的 src 目录下新建 axios.d.ts 文件并键入以下代码,并重新编译运行。 ... 关于博主: 评论和私信会在第一时间回复。或者直接私信我。
Read more >Property 'Provider' does not exist on type 'typeof import.ts(2339)
Property 'wallet' does not exist on type 'Provider'.ts(2339) | Property 'Provider' does not exist on type 'typeof ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having the same problem in my project with JSDoc and axios, but
"moduleResolution": "node"
didn’t seem to solve the problem.I tried to only change the minimal required amount from the
tsc --init
defaults:It seems to recognize stuff in
node_modules/@types
just fine.Update
Seems like it was the default export issue:
For some modules you have to get a little more creative:
More explanation: https://github.com/BeyondCodeBootcamp/jsdoc-typescript-starter/
I fixed this by using
import { default as axios } from 'axios'
.