Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix(button-group): Fix a regression that was introduced with the upda…
Browse files Browse the repository at this point in the history
…te to the new typescript version.

Typescript can now differentiate between properties an get Accessors in the type declarations of the mixins so it broke with the new update

Fixes #1577
  • Loading branch information
Lukas Holzer authored and lukasholzer committed Sep 9, 2020
1 parent 4f9fe16 commit 0193f0b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
22 changes: 11 additions & 11 deletions libs/barista-components/button-group/src/button-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ import {
mixinColor,
mixinTabIndex,
_readKeyCode,
HasElementRef,
} from '@dynatrace/barista-components/core';

export class DtButtonGroupBase {
disabled: boolean;
}
export const _DtButtonGroup = mixinTabIndex(DtButtonGroupBase);
export const _DtButtonGroup = mixinTabIndex(
class {} as Constructor<CanDisable>,
);

@Component({
selector: 'dt-button-group',
Expand Down Expand Up @@ -156,15 +156,14 @@ export interface DtButtonGroupItemSelectionChange<T> {

export type DtButtonGroupThemePalette = 'main' | 'error';
export class DtButtonGroupItemBase {
/** Whether the button group item is disabled. */
disabled: boolean;
constructor(public _elementRef: ElementRef) {}
}

export const _DtButtonGroupItem = mixinTabIndex(
mixinColor<Constructor<DtButtonGroupItemBase>, DtButtonGroupThemePalette>(
DtButtonGroupItemBase,
'main',
),
mixinColor<
Constructor<CanDisable & HasElementRef>,
DtButtonGroupThemePalette
>(DtButtonGroupItemBase as Constructor<CanDisable & HasElementRef>, 'main'),
);

@Component({
Expand Down Expand Up @@ -247,7 +246,8 @@ export class DtButtonGroupItem<T> extends _DtButtonGroupItem
constructor(
private _buttonGroup: DtButtonGroup<T>,
private _changeDetectorRef: ChangeDetectorRef,
_elementRef: ElementRef,
/** @internal */
public _elementRef: ElementRef,
private _focusMonitor: FocusMonitor,
) {
super(_elementRef);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export function mixinColor<
// tslint:disable-next-line:no-any
constructor(...args: any[]) {
super(...args);

// Set the default color that can be specified from the mixin.
this.color = defaultColor as P;
}
Expand Down

0 comments on commit 0193f0b

Please sign in to comment.