Skip to content

Simple TS2531: Object is possibly 'null' #36500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
polRk opened this issue Jan 29, 2020 · 1 comment
Closed

Simple TS2531: Object is possibly 'null' #36500

polRk opened this issue Jan 29, 2020 · 1 comment

Comments

@polRk
Copy link

polRk commented Jan 29, 2020

Снимок экрана 2020-01-29 в 11 35 14 AM

TypeScript Version: 3.7.5

Code

if (bot !== null) {
  resp.sendStatus(404)
}
bot.token

Expected behavior:
bot is not 'null'
Actual behavior:
bot is possibly 'null'
Playground Link:

Related Issues:
#35964, #28131, #27431

@polRk
Copy link
Author

polRk commented Jan 29, 2020

Ohh, my mistake. I should add return.

Снимок экрана 2020-01-29 в 11 39 13 AM

@polRk polRk closed this as completed Jan 29, 2020
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

No branches or pull requests

1 participant