Skip to content

Conversation

@james-strauss-uwa
Copy link
Collaborator

@james-strauss-uwa james-strauss-uwa commented Dec 15, 2025

Set the 'strictNullChecks' flag to 'true' in the Typescript config

This required changes to almost all Typescript files, to make sure we handle all cases where variables are null or undefined.

Significant changes:

  • Node default radii moved to CategoryData
  • The Field constructor can't be given a null value for the node parameter. So a Field can't exist without belonging to a Node. Also, a Field now can't have a null id.
  • Setting.findValue() is now a generic, so we can specify the type we expect to be returned. For example: Setting.findValue<string>(Setting.DOCKER_HUB_USERNAME, "") will return a string. Also notice that we now specify a default value, in case the Setting is undefined.
  • Setting.find(X).setValue(y) can now be done with Setting.setValue(X, y)
  • Translator.DEFAULT_TRANSLATION_ALGORITHM is now defined "alg-1".
  • There are still some consistency issues, but some functions (e.g. getParent()) return null if nothing is set. Some functions (e.g. findNodeById()) return undefined is the object can't be found. This could still use improvement.
  • Node.clear(), Edge.clear() and Field.clear() were unused and removed
  • Defined GraphRenderer.position2d type to use everywhere we use {x:number, y:number}
  • Defined Setting.validValueTypes type (string | number | boolean) that specifies the type that may be stored in Settings

@james-strauss-uwa james-strauss-uwa self-assigned this Dec 15, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @james-strauss-uwa, your pull request is larger than the review limit of 150000 diff characters

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.

2 participants