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

Can Pointer.type be typed as a string union? #1401

Closed
zepumph opened this issue Apr 7, 2022 · 1 comment
Closed

Can Pointer.type be typed as a string union? #1401

zepumph opened this issue Apr 7, 2022 · 1 comment
Assignees

Comments

@zepumph
Copy link
Member

zepumph commented Apr 7, 2022

It breaks modularity a bit, but it could be nice if event.pointer.type wasn't of type string, but instead `pdom'|'mouse'|'touch' etc. @jonathanolson could we have this type directly in Pointer?

The type checker is passing, so I thought I'd commit as a proposal.

I ran into this over in phetsims/molarity#245 where the pointer type was changed for PDOMPointer, but I missed a couple of cases. This probably won't happen again, but it may be nice to improve the typing here, so long as we don't expect users of scenery to add in their own Pointers ad hoc.

@jonathanolson
Copy link
Contributor

This looks great, thanks!

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

No branches or pull requests

2 participants