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

Should Node visibleProperty be IReadOnlyProperty<boolean> ? #1363

Closed
pixelzoom opened this issue Feb 17, 2022 · 1 comment
Closed

Should Node visibleProperty be IReadOnlyProperty<boolean> ? #1363

pixelzoom opened this issue Feb 17, 2022 · 1 comment

Comments

@pixelzoom
Copy link
Contributor

In Geometric Optics, many of my visibleProperty instances are DerivedProperty. But I've noticed that when I pass them to Node, declaring them as IReadOnlyProperty<boolean causes a typescript error, complaining that IReadOnlyProperty does not implement set.

In Node.ts:

  visibleProperty?: IProperty<boolean> | null,

But Node works with a DerivedProperty for visibleProperty, whose set method is:

  set( value: T ): void {
    throw new Error( `Cannot set values directly to a DerivedProperty, tried to set: ${value}` );
  }

So I'm guessing that visibleProperty should really be:

  visibleProperty?: IReadOnlyProperty<boolean> | null,
@samreid
Copy link
Member

samreid commented Dec 9, 2024

Node's option is now visibleProperty?: TReadOnlyProperty<boolean> | null;, closing.

@samreid samreid closed this as completed Dec 9, 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