-
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
TReadOnlyProperty is not linkable #414
Comments
We currently have axon/js/LinkableProperty.ts: type LinkableProperty<T> = TProperty<T> & LinkableElement;
export default LinkableProperty; Should we add |
Probably yes. I still don't have a good picture of the "Property" class/type hierachy in my head. It's much too complicated. See #404 |
I just discovered that Properties in {repo}String.ts are of type So Strings.ts needs to either use type |
I believe we can change the types in {repo}String.ts from |
Yes sounds great to me. I was wondering how far we were going to get using the type instead of the actual Property hierarchy. There is no reason (in my opinion) to keep these as readonly, and instead we should rely on a keen eye from the dev team while using these in sims to narrow the type to readonly as needed. |
I added a TODO linked to this issue in ph-scale Solute.ts. |
I was about to change |
I'm not familiar with why localized strings are of type |
LinkableProperty sounds great. |
@samreid, while @jonathanolson and I were starting the dynamic strings layout guide we began to question the potential pitfalls of |
Do we need a LinkableReadOnlyProperty? |
I would not allow those strings to be writable in cases where they should not be writable. I'd recommend using |
Creating a type alias seems reasonable to me and like the convention will get more use if it's already specified. I think this issue is within my wheelhouse, but perhaps checking in with @jonathanolson first to make sure I'm not overlooking something? |
I created the type alias LinkableReadOnlyProperty, and was going to add documentation when I realized that I can't find documentation for LinkableProperty or LinkableElement. I found this documentation for
@samreid thoughts? |
…LinkableProperty and LinkableReadOnlyProperty, see phetsims/axon#414
…LinkableProperty and LinkableReadOnlyProperty, see phetsims/axon#414
…LinkableProperty and LinkableReadOnlyProperty, see phetsims/axon#414
…LinkableProperty and LinkableReadOnlyProperty, see #414
…LinkableProperty and LinkableReadOnlyProperty, see phetsims/axon#414
I improved the docs, moved LinkableElement to a top-level type, and improved usages in several repos. @marlitas can you please review? Close if all is well. |
Reviewed. Commits look good. Thanks for doing that work @samreid. Should part of the work for this issue be improving usages throughout repos or is a PSA enough? |
I searched for occurrences of |
I sent out a PSA in the |
Having to add
& LinkableElement
in cases like this seems unfortunate:It seems like any "read-only Property" should be linkable, since writeability is not required for something to be a PhET-iO linked element. (It is required to be a PhET-iO element.)
I've had to do this in 9 places during pH Scale conversion to TypeScript phetsims/ph-scale#242.
Probably low priority for now. @samreid thoughts?
The text was updated successfully, but these errors were encountered: