You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was a matter of preference. I preferred to use null to represent leaf nodes rather than an empty array, but certainly it would have been reasonable to use an empty array instead. I am unlikely to change the behavior now as it would not be backwards-compatible, although I suppose I could consider it for a future major version.
It seems to be one of those JavaScriptisms that really infuriate me, but I will leave this as a suggestion.
The
hierarchy
method fills thechildren
field with a list of children if any, andundefined
otherwise.It seems to me that returning an empty list would be much more elegant and practical. For instance I could do:
Is there any good reason for not returning an empty list?
Good thing TypeScript with
strictNullChecks
warned me...The text was updated successfully, but these errors were encountered: