tensorboard icon indicating copy to clipboard operation
tensorboard copied to clipboard

Fix initializer of instance members that reference identifiers declar…

Open frost-cy opened this issue 1 year ago • 1 comments

…ed in the constructor.

Motivation for features / changes

When public class fields are enabled, such cases throw a TS error similar to this.

third_party/javascript/angular_components/src/cdk/platform/platform.ts:37:29 - error TS2729: Property '_platformId' is used before its initialization.

37   isBrowser: boolean = this._platformId
                               ~~~~~~~~~~~

  third_party/javascript/angular_components/src/cdk/platform/platform.ts:87:15
    87   constructor(@Inject(PLATFORM_ID) private _platformId: Object) {}
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    '_platformId' is declared here.

This error is fixed by moving the initializer of such class members into the constructor.

This is a no-op change

See go/lsc-fix-properties-used-before-initialization

Technical description of changes

Fix initializer of instance members that reference identifiers declared in the constructor.

Screenshots of UI changes (or N/A)

N/A

Detailed steps to verify changes work correctly (as executed by you)

This is a no-op change

Alternate designs / implementations considered (or N/A)

N/A

frost-cy avatar Jul 17 '24 19:07 frost-cy

Unfortunately our OSS project uses different lint rules. Please run yarn fix-lint. Alternatively patch this commit

rileyajones avatar Jul 17 '24 20:07 rileyajones