Skip to content

Commit

Permalink
TypeScript conversion for RectangularPushButton/PushButtonModel (and …
Browse files Browse the repository at this point in the history
…inherited types), Slider/SliderTrack (and associated types), NumberControl/ArrowButton/NumberDisplay, see phetsims/scenery-phet#726
  • Loading branch information
jonathanolson committed Mar 5, 2022
1 parent 5f2bd83 commit 64b6862
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/Property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ type PropertyOptions<T> = Partial<PropertyDefinedOptions> & {
} & PhetioObjectOptions;

// a Property (can't be a TinyProperty) with all of the value-mutation removed.
export type ReadOnlyProperty<T> = Omit<Property<T>, 'set' | 'reset'> & { readonly value: T; };
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;
}

class Property<T> extends PhetioObject implements IProperty<T> {

Expand Down

0 comments on commit 64b6862

Please sign in to comment.