IONIC 4 You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

hey guyz im facing an error while trying to refresh the token from the interceptor

ERROR TypeError: You provided ‘undefined’ where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.

heres my code i posted the question on stack overflow if someone can help

What happens if you take a vow of never casting anything to any?

i usually don’t use any but i followed some tutorials on how to do the refresh token and they used it so i was waiting to fix this error and remove all the any from my interceptor.
but when i remove the as any from the switch Map in the handleHttpErrorResponse function it gives me errors so i kept it,
do you have any idea of whats causing this error ?
every time the refresh token in called i get this error and the 400 (Bad Request)

Exactly why I said what I did.

The build system is trying to help you fix the underlying problem, and when you subvert the type system you are telling it “shut up, I don’t want your help”. So let’s work on the code you have when there is no casting to any.

While we’re at it, how about enabling noImplicitAny in tsconfig.json as well? That will ensure you declare return value types for all functions (especially looking at you, logout).

i edited the code a bit and removed some of the any

So what does it look like now and what has changed?

i was deebugging and fixed the error of the 400 (Bad Request)
it was an error in the refresh token duration but when i get an error in the interceptor the same error is still showing the one of You provided ‘undefined’ where a stream was expected. You can provide an Observable, Promise, Array, or Iterable

I’m still waiting to see what the code looks like after everything has proper type declarations.