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

Unnecessary assertion in constructor. #419

Open
pixelzoom opened this issue Oct 21, 2024 · 0 comments
Open

Unnecessary assertion in constructor. #419

pixelzoom opened this issue Oct 21, 2024 · 0 comments

Comments

@pixelzoom
Copy link
Contributor

In RadiationDescriber.ts:

class RadiationDescriber {

  public constructor() {

    // At the time of this writing (Aug 2023), there are only static usages of this type, so the constructor has been
    // disallowed.  If state is ever needed, feel free to change this.  See
    // https://github.com/phetsims/greenhouse-effect/issues/339.
    assert && assert( false, 'Intended, at least originally, to only be used statically.' );
  }

The assertion is unnecessary. In general, the way to "disallow" a constructor is to make it private:

class RadiationDescriber {

   // At the time of this writing (Aug 2023), there are only static usages of this type, so the constructor is private.  If state is ever 
   // needed, feel free to change this.  See https://github.com/phetsims/greenhouse-effect/issues/339.
  private constructor() {}
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

1 participant