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

GroupItemOptions and ToggleNode should know what subtype of Node they are creating #846

Closed
samreid opened this issue May 10, 2023 · 2 comments

Comments

@samreid
Copy link
Member

samreid commented May 10, 2023

For phetsims/center-and-variability#170, it would be helpful for GroupItemOptions and ToggleNode to know what subtype of Node they are creating.

@samreid
Copy link
Member Author

samreid commented May 10, 2023

@zepumph can you please help review this issue? See also TODOs in phetsims/center-and-variability#201 where type inference isn't working as expected. This issue is related to iteration item https://github.com/orgs/phetsims/projects/65?pane=issue&itemId=27371596 which is priority 10.1 overall.

@samreid samreid assigned zepumph and unassigned samreid May 10, 2023
zepumph added a commit to phetsims/center-and-variability that referenced this issue May 19, 2023
@zepumph
Copy link
Member

zepumph commented May 19, 2023

We got rid of the defaults and type inference is working well when each createNode creates the same type.

When having the heterogenous elements list like in VariabilityPlotNode, we found microsoft/TypeScript#33664 and microsoft/TypeScript#31617 (comment) and as a result are happy to chock this up to a weirdness of TypeScript lazily inferring the first generic. Typescript has done this by design, and they aren't changing.

We are ready to close and are fine specifying things manually when needing a Supertype for a heterogenous array of elements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants