restyped-axios
restyped-axios copied to clipboard
URLs aren't statically checked when using `.get(…)`, `.post(…)`, etc
Because the definitions of get(…)
, post(…)
, etc use Path | string
, invalid paths aren't checked:
So, for example, this will compile without issue:
interface MyAPI {
'/foo': {}
}
let api = axios.create<MyAPI>()
api.get('/bar') // <-- compiles
I realize that this is necessary to support paths with query parameters… but it should really be noted in the documentation, because it's pretty surprising :)