Type 'ConnectionState' is not assignable to type 'boolean'
I am getting this error when I use a function to monitor whether the internet is there or not. Can anyone help me to resolve this error? Here is the app,component.ts file
5 Replies
you're defining
isConnected
as having type ConnectionState
, and it's telling you a variable of type ConnectionState
can't have a value of false
I've made it like this
still I'm getting the same error
ConnectionState
has this signature:
I'm guessing the connectionService
subscription is passing in a ConnectionState
object, and not just a boolean
so when you're assigning isConnected
to this.isConnected
, it tells you you can't assign a ConnectionState
variable to a boolean one
probably this will solve your issue, instead of this.isConnected = isConnected;
use this
Yeah it did, thanks so much @jochemm
no problem!