import { ElementRef } from '@angular/core' ; export class MDCComponent < FoundationType extends any > { protected _elementRef : ElementRef ; protected _foundation : FoundationType ; constructor ( elementRef , foundation ? , ... args ) { this . _elementRef = elementRef ; this . initialize ( ... args ) ; this . _foundation = foundation === undefined ? this . getDefaultFoundation ( ) : foundation ; } initialize ( ... _args ) { } getDefaultFoundation ( ) { throw new Error ( 'Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class' ) ; } destroy ( ) { this . _foundation ?. destroy ( ) ; } }