Hi :wave: The TS SDK uses `axios` internally. How...
# contributors
b
Hi đź‘‹ The TS SDK uses
axios
internally. However, consumers don’t necessarily need to install that dependency. When dealing with error handling we need to type the
error
as
AxiosError
. The
@ory/client
package doesn’t export that type declaration, requiring consumers to install
axios
just for accessing the type. If would be great if the type
AxiosError
can be exported from the
@ory/client
package so that consumers don’t need to explicitly install
axios
dependency. Would that be possible? Happy to contribute to that if needed. Thanks 🤗
d
could you use Typescript’s ReturnType utility type?
b
The
ReturnType
is used for functions. Here we’re talking about the
error
object.
Copy code
try {
  // some Ory API call
} catch (error) {
  if (error instanceof AxiosError) {
    // handle error
  }
}
If
axios
is meant to be an implementation detail, we can also expose the error type with a different name like
OryError
or something.
d
Ah yep sorry, wasn't thinking straight
🤗 1
b
No worries