Skip to content
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

Avoid null as return type #169

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Avoid null as return type #169

wants to merge 1 commit into from

Conversation

javagl
Copy link
Contributor

@javagl javagl commented Jan 29, 2025

Addresses #162

Builds upon #167 - will be processed further after this one is merged.

There have been a few places that used null as a return type. While there are possible justifications for that, it was hard to ensure consistency in that regard (and it seems to be pretty uncommon in other codebases like CesiumJS). This PR changes the use of these null values to undefined.

The affected places:

  • ResourceResolver.resolve... functions returned null when the data could not be resolved, but return undefined now
  • ContentData.getData (which usually contained the data that was obtained with a ResourceResolver) could be null, and can now be undefined accordingly
  • The TreeCoordinates interface returned null as the parent of root nodes. This also returns undefined now

(The other changes are the respective implementations and places where these values had been used)


Note: There is still a large part of the codebase that does use null - namely, the implementations of the glTF extensions based on glTF-Transform. This is because glTF-Transform internally does use null, pretty consistently. So it makes sense to use null in these implementations as well.

Base automatically changed from async-source-and-target to main January 31, 2025 18:08
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.

1 participant