Skip to content

Conversation

@s-h-a-d-o-w
Copy link

@s-h-a-d-o-w s-h-a-d-o-w commented Jan 2, 2025

The user has no control over the fact that on first render, lastJsonMessage will be null. And it always is like that (I suspect. Without digging through the code, I don't imagine there's a scenario where the socket is established and sets the value quickly enough for it not to be?).

And so I would argue that the user should have no option of not including null. They might also wrongly assume that undefined is used.

@PrakashC1
Copy link

I was surprised — the documentation states the type is T | null, but in the actual library, null isn’t included. However, during the initial load, lastJsonMessage is actually null

After enabling the ESLint rule @typescript-eslint/no-unnecessary-condition, it started flagging all my null checks as unnecessary.

@cadonau
Copy link

cadonau commented Jul 2, 2025

I was surprised — the documentation states the type is T | null, but in the actual library, null isn’t included. […]

I just noticed (/ran into) the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants