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

TypeScript conversion #726

Closed
jonathanolson opened this issue Mar 5, 2022 · 16 comments
Closed

TypeScript conversion #726

jonathanolson opened this issue Mar 5, 2022 · 16 comments

Comments

@jonathanolson
Copy link
Contributor

Creating an issue to tag commits (for review), and to discuss potential problems in conversion.

@jonathanolson jonathanolson self-assigned this Mar 5, 2022
jonathanolson added a commit to phetsims/axon that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/bamboo that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/bending-light that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/build-a-nucleus that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/center-and-variability that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/chipper that referenced this issue Mar 5, 2022
jonathanolson added a commit to phetsims/forces-and-motion-basics that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/geometric-optics that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/greenhouse-effect that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/greenhouse-effect that referenced this issue Mar 5, 2022
jonathanolson added a commit to phetsims/quadrilateral that referenced this issue Mar 5, 2022
jonathanolson added a commit to phetsims/ratio-and-proportion that referenced this issue Mar 5, 2022
jonathanolson added a commit to phetsims/scenery that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see #726
jonathanolson added a commit to phetsims/sun that referenced this issue Mar 5, 2022
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
jonathanolson added a commit to phetsims/tambo that referenced this issue Mar 5, 2022
@jonathanolson
Copy link
Contributor Author

@jbphet I converted some tambo bits since Slider depended on the options object for ValueChangeSoundGenerator. Can you review that portion?

@jonathanolson
Copy link
Contributor Author

InteractionStateProperty looks really tricky here. They use different value sets for different concrete controls, but it's used in e.g. RectangularButton. I've had to type it as IProperty<ButtonInteractionState | RadioButtonInteractionState> in places.

We may need to parameterize the core types e.g. class RectangularButton<InteractionState>, or figure out other solutions.

@samreid
Copy link
Member

samreid commented Mar 7, 2022

@chrisklus and I noticed that ReadOnlyProperty was written like this:

export interface ReadOnlyProperty<T> extends Property<T> {
  readonly value: T;

  // Any solution with Omit<Property<T>, 'set' | 'reset'> was failing, as it wasn't assignable to PhetioObject
  set: unknown & any;
  reset: unknown & any;
}

However, this means that this code type checks:

const p = new Property( 1 );
const x: ReadOnlyProperty<number> = p;
x.set( 7 );

Also, we were surprised to see phetsims/center-and-variability@b416354 where an IReadOnlyProperty was converted to Property. It seems it should remain read-only. @jonathanolson can you please advise?

jonathanolson added a commit to phetsims/area-model-common that referenced this issue Mar 7, 2022
@pixelzoom pixelzoom removed their assignment Mar 15, 2022
jbphet added a commit to phetsims/tambo that referenced this issue Mar 23, 2022
jbphet added a commit to phetsims/tambo that referenced this issue Mar 23, 2022
@jbphet
Copy link
Contributor

jbphet commented Mar 23, 2022

The 'tambo bits' have been reviewed and look good, though I did make some minor touchups.

@jbphet jbphet removed their assignment Mar 23, 2022
@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 6, 2022

@jonathanolson It's been ~30 days since we discussed deleting ReadOnlyProperty, see #726 (comment). If ReadOnlyProperty is not going to be fixed, can we please remove it? More than once, I've accidentally ended up with ReadOnlyProperty when I wanted IReadOnlyProperty. See phetsims/axon#377.

@samreid
Copy link
Member

samreid commented Apr 6, 2022

I'll work on removing it momentarily, in phetsims/axon#377

@pixelzoom
Copy link
Contributor

pixelzoom commented Apr 6, 2022

Unfortunately ReadOnlyProperty unintentionally made it into Geometric Optics 1.1. Not too happy about that...

@samreid
Copy link
Member

samreid commented Apr 6, 2022

It sounds pretty safe to remove it in a maintenance release commit, if you like.

@samreid
Copy link
Member

samreid commented May 11, 2022

@jonathanolson can you please report on this status? @zepumph and I are curious whether it's still blocking for the upcoming PhET-iO milestone.

@jonathanolson
Copy link
Contributor Author

I believe ReadOnlyProperty is now part of the axon hierarchy. @samreid anything left to do here?

@jonathanolson jonathanolson removed their assignment Sep 20, 2022
@samreid
Copy link
Member

samreid commented Sep 22, 2022

To clarify, interface ReadOnlyProperty was removed in phetsims/axon@5a14223. Then in June we added class ReadOnlyProperty in phetsims/axon#382, which has been working much better. So I think that aspect of the issue can be closed.

I'm uncertain about #726 (comment) or the rest of the scope of this issue, up to you.

@pixelzoom
Copy link
Contributor

Remaining TypeScript work is in scenery-phet is tracked in separate issues. So this issue can be closed.

samreid pushed a commit to phetsims/perennial that referenced this issue Oct 22, 2024
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

4 participants