-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
refactor: switch typeof undefined checks with strict comparison of the value undefined #7006
Conversation
…e value undefined
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit f19a867. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
typeof defaultedOptions.networkMode === 'undefined' && | ||
defaultedOptions.persister | ||
) { | ||
if (!defaultedOptions.networkMode && defaultedOptions.persister) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
networkMode
is a string literal type so doing the simplified !
check should be safe. We can't do that for the above booleans obviously
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f19a867:
|
typeof fetchStatus !== 'undefined' && | ||
fetchStatus !== query.state.fetchStatus | ||
) { | ||
if (fetchStatus && fetchStatus !== query.state.fetchStatus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here: fetchStatus
is not a boolean, we just need to check if it was passed
It may be handy to use a more semantic utility with a positive naming convention. const isDefined = <Value>(value: Value | null | undefined): value is Value =>
value !== null && value !== undefined; Adding or not the |
We can't check for null because data can be null - it just can't be undefined |
No description provided.