Skip to content

Commit

Permalink
fix(switch): fix strict generic checks
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 291002539

Co-authored-by: Material Web Copybara Robot <59487319+material-web-copybara@users.noreply.github.com>
  • Loading branch information
asyncLiz and material-web-copybara authored Jan 24, 2020
1 parent f2426d2 commit 7f5e0c2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/mdc-switch/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

import {MDCComponent} from '@material/base/component';
import {EventType} from '@material/base/types';
import {EventType, SpecificEventListener} from '@material/base/types';
import {applyPassive} from '@material/dom/events';
import {matches} from '@material/dom/ponyfill';
import {MDCRippleAdapter} from '@material/ripple/adapter';
Expand Down Expand Up @@ -104,15 +104,19 @@ export class MDCSwitch extends MDCComponent<MDCSwitchFoundation> implements MDCR
...MDCRipple.createAdapter(this),
addClass: (className: string) => rippleSurface.classList.add(className),
computeBoundingRect: () => rippleSurface.getBoundingClientRect(),
deregisterInteractionHandler: (evtType: EventType, handler: EventListener) => {
deregisterInteractionHandler: <K extends EventType>(
evtType: K, handler: SpecificEventListener<K>) => {
this.nativeControl_.removeEventListener(evtType, handler, applyPassive());
},
isSurfaceActive: () => matches(this.nativeControl_, ':active'),
isUnbounded: () => true,
registerInteractionHandler: (evtType: EventType, handler: EventListener) => {
registerInteractionHandler: <K extends EventType>(
evtType: K, handler: SpecificEventListener<K>) => {
this.nativeControl_.addEventListener(evtType, handler, applyPassive());
},
removeClass: (className: string) => rippleSurface.classList.remove(className),
removeClass: (className: string) => {
rippleSurface.classList.remove(className);
},
updateCssVariable: (varName: string, value: string) => {
rippleSurface.style.setProperty(varName, value);
},
Expand Down

0 comments on commit 7f5e0c2

Please sign in to comment.