File tree 4 files changed +32
-6
lines changed 4 files changed +32
-6
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import {htmlTemplate} from './gr-autocomplete-dropdown_html';
25
25
import { KeyboardShortcutMixin } from '../../../mixins/keyboard-shortcut-mixin/keyboard-shortcut-mixin' ;
26
26
import { IronFitMixin } from '../../../mixins/iron-fit-mixin/iron-fit-mixin' ;
27
27
import { customElement , property , observe } from '@polymer/decorators' ;
28
+ import { IronFitBehavior } from '@polymer/iron-fit-behavior/iron-fit-behavior' ;
28
29
29
30
// TODO(TS): Update once GrCursorManager is upated
30
31
export interface GrAutocompleteDropdown {
@@ -55,7 +56,8 @@ interface Item {
55
56
export class GrAutocompleteDropdown extends IronFitMixin (
56
57
KeyboardShortcutMixin (
57
58
GestureEventListeners ( LegacyElementMixin ( PolymerElement ) )
58
- )
59
+ ) ,
60
+ IronFitBehavior as IronFitBehavior
59
61
) {
60
62
static get template ( ) {
61
63
return htmlTemplate ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import {PolymerElement} from '@polymer/polymer/polymer-element';
21
21
import { htmlTemplate } from './gr-overlay_html' ;
22
22
import { IronOverlayMixin } from '../../../mixins/iron-overlay-mixin/iron-overlay-mixin' ;
23
23
import { customElement , property } from '@polymer/decorators' ;
24
+ import { IronOverlayBehavior } from '@polymer/iron-overlay-behavior/iron-overlay-behavior' ;
24
25
25
26
const AWAIT_MAX_ITERS = 10 ;
26
27
const AWAIT_STEP = 5 ;
@@ -34,7 +35,8 @@ declare global {
34
35
35
36
@customElement ( 'gr-overlay' )
36
37
export class GrOverlay extends IronOverlayMixin (
37
- GestureEventListeners ( LegacyElementMixin ( PolymerElement ) )
38
+ GestureEventListeners ( LegacyElementMixin ( PolymerElement ) ) ,
39
+ IronOverlayBehavior as IronOverlayBehavior
38
40
) {
39
41
static get template ( ) {
40
42
return htmlTemplate ;
Original file line number Diff line number Diff line change @@ -22,8 +22,19 @@ import {Constructor} from '../../utils/common-util';
22
22
23
23
// The mixinBehaviors clears all type information about superClass.
24
24
// As a workaround, we define IronFitMixin with correct type.
25
+ // Due to the following issues:
26
+ // https://github.com/microsoft/TypeScript/issues/15870
27
+ // https://github.com/microsoft/TypeScript/issues/9944
28
+ // we have to import IronFitBehavior in the same file where IronFitMixin
29
+ // is used. To ensure that this import can't be avoided, the second parameter
30
+ // is added. Usage example:
31
+ // class Element extends IronFitMixin(PolymerElement, IronFitBehavior as IronFitBehavior)
32
+ // The code 'IronFitBehavior as IronFitBehavior' required, becuase IronFitBehavior
33
+ // defined as an object, not as IronFitBehavior instance.
34
+
25
35
export const IronFitMixin = < T extends Constructor < PolymerElement > > (
26
- superClass : T
36
+ superClass : T ,
37
+ _ : IronFitBehavior
27
38
) : T & Constructor < IronFitBehavior > =>
28
39
// TODO(TS): mixinBehaviors in some lib is returning: `new () => T` instead
29
40
// which will fail the type check due to missing IronFitBehavior interface
Original file line number Diff line number Diff line change @@ -22,9 +22,20 @@ import {Constructor} from '../../utils/common-util';
22
22
23
23
// The mixinBehaviors clears all type information about superClass.
24
24
// As a workaround, we define IronOverlayMixin with correct type.
25
+ // Due to the following issues:
26
+ // https://github.com/microsoft/TypeScript/issues/15870
27
+ // https://github.com/microsoft/TypeScript/issues/9944
28
+ // we have to import IronOverlayBehavior in the same file where IronOverlayMixin
29
+ // is used. To ensure that this import can't be avoided, the second parameter
30
+ // is added. Usage example:
31
+ // class Element extends IronOverlayMixin(PolymerElement, IronOverlayBehavior as IronOverlayBehavior)
32
+ // The code 'IronOverlayBehavior as IronOverlayBehavior' required, because
33
+ // IronOverlayBehavior defined as an object, not as IronOverlayBehavior instance.
25
34
export const IronOverlayMixin = < T extends Constructor < PolymerElement > > (
26
- superClass : T
35
+ superClass : T ,
36
+ _ : IronOverlayBehavior
27
37
) : T & Constructor < IronOverlayBehavior > =>
28
- // TODO(TS): mixinBehaviors in some lib is returning: `new () => T` instead
29
- // which will fail the type check due to missing IronOverlayBehavior interface
38
+ // TODO(TS): mixinBehaviors in some lib is returning: `new () => T`
39
+ // instead which will fail the type check due to missing
40
+ // IronOverlayBehavior interface
30
41
mixinBehaviors ( [ IronOverlayBehavior ] , superClass ) as any ;
You can’t perform that action at this time.
0 commit comments