-
Notifications
You must be signed in to change notification settings - Fork 8
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
NumberProperty Typescript improvements around rangeProperty #425
Comments
@jonathanolson @marlitas and @samreid and I updated NumberProperty's range pattern to get rid of the notion of null. It is working really well, and we are happy to move in this direction. Instead of a default of null, we default to Range.EVERYTHING (same pattern as for bounds). We are happy to get rid of From here we may look into a default Range that throws errors if you try to mutate it:
I'll check back in on Monday to see if there was trouble from the commit. |
In the above commits, I deleted 21 redundant range assertions that I was able to identify in my code. There are probably others that I haven't identified, and I didn't touch code that I didn't write. |
Yes, this interface should stick around to signify an interface that has a range. It is used in the project by DynamicProperties that can't be a NumberProperty. I updated NumberProperty to say that it implements RangedProperty though, for clarity.
I found a couple more assertions with
Good call! I just posted to the google group:
Thanks for the impromptu review. Anything else here? |
Two remaining issues: (1) Factor out RangedProperty.ts. (2) Address hackery in UnitConversionProperty. You said:
I see one such DynamicProperty: UnitConversionProperty. It contains this hackery: public constructor( property: TProperty<number>, ... )
...
if ( ( property as NumberProperty ).rangeProperty ) { Why isn't the constructor parameter |
The type was written to support provided Properties with or without Range, but I updated the code to be explicit and type safe instead of type casting. I also renamed to TRangedProperty because @marlitas and I thought that was a bit less confusing in a conversation yesterday over the Property hierarchy+TypeScript. Do you think that LinkableProperty should be TLinkableProperty? Anything else here @pixelzoom? |
No, I don't think that's necessary.
Nope, closing. Thanks! |
No description provided.
The text was updated successfully, but these errors were encountered: