Skip to content

Commit

Permalink
fix(kit): TuiDataListGroupWrapperComponent is not assignable to the…
Browse files Browse the repository at this point in the history
… same property in base type (#8461)
  • Loading branch information
splincode authored Aug 12, 2024
1 parent 31a4057 commit 933be65
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ import {TuiDataListWrapperComponent} from './data-list-wrapper.component';
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [tuiAsDataListAccessor(TuiDataListGroupWrapperComponent)],
})
export class TuiDataListGroupWrapperComponent<T> extends TuiDataListWrapperComponent<T> {
@Input()
// @ts-ignore
public override items: readonly T[][] | null = [];

export class TuiDataListGroupWrapperComponent<T> extends TuiDataListWrapperComponent<
T,
T[]
> {
@Input()
public labels: readonly string[] = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ import {PolymorpheusOutlet} from '@taiga-ui/polymorpheus';
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [tuiAsDataListAccessor(TuiDataListWrapperComponent)],
})
export class TuiDataListWrapperComponent<T> {
export class TuiDataListWrapperComponent<T, K = T> {
private readonly itemsHandlers: TuiItemsHandlers<T> = inject(TUI_ITEMS_HANDLERS);

@ViewChildren(forwardRef(() => TuiOption))
protected readonly optionsQuery: QueryList<TuiOption<T>> = EMPTY_QUERY;

@Input()
public items: readonly T[] | null = [];
public items: readonly K[] | null = [];

@Input()
public disabledItemHandler: TuiItemsHandlers<T>['disabledItemHandler'] =
Expand Down Expand Up @@ -75,4 +75,8 @@ export class TuiDataListWrapperComponent<T> {
.map(({value}) => value)
.filter(tuiIsPresent);
}

protected $cast(items: readonly K[]): readonly T[] {
return items as unknown as readonly T[];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[size]="size"
>
<button
*ngFor="let item of items"
*ngFor="let item of $cast(items)"
#elementRef="elementRef"
automation-id="tui-data-list-wrapper__option"
tuiElement
Expand Down

0 comments on commit 933be65

Please sign in to comment.