-
Notifications
You must be signed in to change notification settings - Fork 162
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
TypeScript: Address strictNullChecks
violations
#1888
Comments
const unrootedPlaceSubtree = (node: PhyloNode, totalLeafWeight: number) => {
// FIXME: consider an UnrootedPhyloNode that guarantees presence of these? will need some casting...
if (node.depth === undefined || ... ) {
return;
} This looks safe (the function handles the optional properties) but if it's ever triggered it indicates a much larger bug in the architecture of Auspice, namely that this function should never be called if these values haven't been set. Returning or throwing essentially masks this deeper more structural issue. Ideally the type system would provide guarantees about the overall architecture and ensure that a function like |
As we discussed yesterday, I think the best approach here is to have 2 types per "thing" — one where the properties are largely optional and a second where they're not (insert naming bikeshed convo here...) — and then use type guards to "up-convert" the optional form into the fully reified one. |
Sorry to shift the conversation. I want to split up this issue vs. #1889 because, while I think a bulk of the |
from #1864 (comment)
The TSConig option strictNullChecks will be disabled with #1864. We should re-enable it to catch existing bugs and prevent new bugs.
Possible solutions
The text was updated successfully, but these errors were encountered: