-
Notifications
You must be signed in to change notification settings - Fork 163
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
Update entropy types #1915
Update entropy types #1915
Conversation
ce1f446
to
cad5eb6
Compare
This allows for more specific type narrowing.
Improves readability.
Improves readability.
This allows some code editors to show the comment on hover. I also added two new types (Phase, Frame) to replace some comments. Notably, a type assertion in _frame is a necessary part of this translation. I considered extracting the modulus operation into a separate _mod3 function to reduce clutter in the _frame function, however that seemed to be an unnecessary complication.
For consistency.
These were not consistent in the same file. I've also opted to not use them in the tree component types.
The previous error message code indicated the possibility that this property is unset. Express that directly in the type annotation and simplify the error message code.
Checking against undefined is more direct.
The function is only used in two places, both of which specify a valid strand value.
This is only used in one place, so use it directly.
Setting the nested dictionary value directly is more readable.
These types had ignored the reality that the JSON input can be anything. The removal better aligns with the validation that is already present in the functions. More validation has been added to accommodate for newly exposed type errors.
0d9600b
to
d3e89c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up reading through the code changes all together as there was a fair bit of layering - it all looks good from what I can tell. If there's anything particular to look at please let me know & I can re-check.
"Note that -ve strand RNA viruses are typically annotated as 5' → 3'."); | ||
|
||
if (!nucAnnotation) { | ||
throw new Error("Genome annotation missing 'nuc' definition"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[comment, no changes please] This made me think of how nice it'd be to have #1813
Thanks for the reviews @genehack and @jameshadfield! Merging this now. |
Description of proposed changes
Updates TypeScript usage to be consistent with #1864, etc.
I thought of these changes after adding 6215591.
Discussions
%3
operationas Frame
oras 0 | 1 | 2
?Checklist
If making user-facing changes, add a message in CHANGELOG.md summarizing the changes in this PR(to be done by a Nextstrain team member) Create preview PRs on downstream repositories.