Repository navigation
Check every index read in the app and the embed: the flag is on - #416
Merged
Merged
Conversation
The last noUncheckedIndexedAccess findings in the app, in render.component.ts (62) and diagram.service.ts (23), handled without adding a non-null assertion; the app and the embeddable diagram now have the flag in their own tsconfig.app.json, so their builds enforce it. Turning it on also checked the templates, which tsc alone does not: five reads, four of them a sample's expression value passed to cr-expression-tag, which now draws only when there is a value to draw. The counted check moves on to what is left: the two workspace libraries, reactome-table and reactome-gsa-form, 84 findings in 10 files. When they reach zero the flag goes into tsconfig.json and the check goes. One stated change: a diagram link with no input or output already threw; it now says which link. Part of #345. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erge From review: - pick threw whenever the value it drew was undefined; one caller picks undefined on purpose. It throws only for an empty list now. - An EntitySet link with no ends was silently dropped by the filter rather than reaching the named error; it is kept, and refused below as stated. - closestToAverage over no positions threw before, as the diagram could not be laid out; it throws again, saying why, instead of placing a shadow at NaN. - tsconfig.json's comment said the flag was off. - The per-project merge in the check is exported and has a test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #345. This is the last of the app's
noUncheckedIndexedAccessfindings. The flag is now on intsconfig.app.jsonandprojects/reactome-diagram-element/tsconfig.app.json, so the builds enforce it.The two files
render.component.ts(62): the figure renderer's geometry. Most findings came from a few reads (a chord's ends, a polygon's previous vertex, a segment's ends, the arrow's tip). Each now has a guard that can't fire on real data, because every index is in range by construction. The four-edge clip loop gets a pair type. Exports takeconst [instance] = instances.diagram.service.ts(23): closest-to-average,pick, the normal-pathway id, CHEBI ids, sub-pathway pairs, homomer children, compartment insets (now over a typed list of sides, in the same order asObject.keysgave), polymer units, link ends, and the legend's node/reaction pairing.Templates
tscdoesn't check templates, but with the flag on, Angular's strict template checking does. It found five more:exp[i],values[i]) tocr-expression-tag, which isn't built for a missing one (a GSA label lookup and the colour scale would break). Those cells now read the value with@letand draw the tag only when there is one. The index is in range in practice, so nothing changes on screen.entities-{resource}id it's computed from.Behaviour
link.inputs[0].id. It now throwsLink {id} has no input or no output.chebi:prefix used to addundefinedto the set of ids looked up. It's now left out, so the page no longer asks EBI for/compound/NaN/structure/.pickthrows only for an empty list (one caller picksundefinedon purpose); an EntitySet link with no ends reaches the named error instead of being filtered out;closestToAverageover no positions throws, as it did, with a message, instead of placing a shadow at NaN.The check moves on
scripts/check-indexed-access.mjsnow counts the projects that don't have the flag yet: the workspace librariesreactome-table(66) andreactome-gsa-form(18), 84 findings in 10 files. When they reach zero, the flag goes intotsconfig.jsonand the check goes. (tsconfig.spec.jsonstays out: it can't resolvevitest/globals, ascheck-types.mjsnotes.)Tests
xs[0].lengthfailscheck:typeswith TS2532.npm run buildandnpm run build:embedwith the flag: both complete.check:lintandcheck:indexedunchanged at the baseline.🤖 Generated with Claude Code