-
Notifications
You must be signed in to change notification settings - Fork 33
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
[DevTask] Explicit null vs undefined #595
Comments
webfiltered
added a commit
that referenced
this issue
Feb 25, 2025
- Adds NullGraphError to reduce boilerplate null check code - Reference: #595
webfiltered
added a commit
that referenced
this issue
Feb 25, 2025
- Adds NullGraphError to reduce boilerplate null check code - Reference: #595
webfiltered
added a commit
that referenced
this issue
Feb 25, 2025
Prefer undefined to explicit null, add NullGraphError - Adds NullGraphError to reduce boilerplate null check code - Reference: #595
webfiltered
added a commit
that referenced
this issue
Feb 25, 2025
- Adds `NullGraphError` to reduce boilerplate null check code - Prefer optional `undefined` to explicit `null` - Related: #595 - Adds strict types
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current
There are enough discussions on this topic, but as it pertains to Litegraph, the vast majority
null
usage in the library appears to be stylistic, rather than functional.Strict typing in TypeScript becomes extremely verbose when
null
is used simply as a stand-in for idiomaticundefined
. Worse still, it often requires runtime guards to guarantee type safety.Proposed
Wherever
null
is used for indeterminate purposes, and could simply be replaced withundefined
(or e.g. just not returning a value), it should be.Prefer shorthand where appropriate, e.g. optional properties. Adding
| undefined
works for props/params that must be specified, but may not have a value.Any use of explicit null where it is strict-equality checked can be ignored - it's serving some purpose or another. There are only a handful of instances, anyway.
The text was updated successfully, but these errors were encountered: