Material Web Team 0f6d402472 Add the override keyword to class members in TypeScript files
TypeScript’s override keyword (added in 4.3) works similarly to @Override in Java. It makes the intention clear and ensures there is actually a member in the base class with the same name. This helps with things like:
- Typos in the overriding member name
- Remember to rename members in sub classes when renaming an overridden member in a base class

class Parent {
  foo() {}
}

class Child extends Parent {
  override bar() {}
  //       ~~~ This member cannot have an 'override' modifier because it is not declared in the base class 'Parent'.
}

This change will not cause a runtime change: the override keyword is not present in the resulting JavaScript.

PiperOrigin-RevId: 399452347
2021-09-28 09:00:31 -07:00

27 lines
641 B
TypeScript

/**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {customElement} from 'lit/decorators.js';
import {ElevatedButton as ElevatedButtonBase} from './lib/elevated-button';
import {styles as elevatedStyles} from './lib/elevated-styles.css';
import {styles as sharedStyles} from './lib/shared-styles.css';
declare global {
interface HTMLElementTagNameMap {
'md-elevated-button': ElevatedButton;
}
}
/**
* @soyCompatible
* @final
*/
@customElement('md-elevated-button')
export class ElevatedButton extends ElevatedButtonBase {
static override styles = [sharedStyles, elevatedStyles];
}