Skip to content

Commit 56cbbfc

Browse files
author
Ben Grynhaus
committed
Better type for ICommandBarItemOptions.
Now completes in intellisense/auto-complete properly.
1 parent ba64b4f commit 56cbbfc

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

libs/fabric/src/lib/components/command-bar/command-bar.component.ts

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,34 @@
22
// Licensed under the MIT License.
33

44
import { InputRendererOptions, Omit, ReactWrapperComponent } from '@angular-react/core';
5-
import { AfterContentInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ElementRef, EventEmitter, Input, OnDestroy, Output, QueryList, Renderer2, ViewChild } from '@angular/core';
5+
import {
6+
AfterContentInit,
7+
ChangeDetectionStrategy,
8+
ChangeDetectorRef,
9+
Component,
10+
ContentChild,
11+
ElementRef,
12+
EventEmitter,
13+
Input,
14+
OnDestroy,
15+
Output,
16+
QueryList,
17+
Renderer2,
18+
ViewChild,
19+
} from '@angular/core';
620
import { ICommandBarItemProps, ICommandBarProps } from 'office-ui-fabric-react/lib/CommandBar';
721
import { IContextualMenuItem } from 'office-ui-fabric-react/lib/ContextualMenu';
822
import { Subscription } from 'rxjs';
923
import { OnChanges, TypedChanges } from '../../declarations/angular/typed-changes';
1024
import omit from '../../utils/omit';
1125
import { mergeItemChanges } from '../core/declarative/item-changed';
1226
import { CommandBarItemChangedPayload, CommandBarItemDirective } from './directives/command-bar-item.directives';
13-
import { CommandBarFarItemsDirective, CommandBarItemsDirective, CommandBarItemsDirectiveBase, CommandBarOverflowItemsDirective } from './directives/command-bar-items.directives';
27+
import {
28+
CommandBarFarItemsDirective,
29+
CommandBarItemsDirective,
30+
CommandBarItemsDirectiveBase,
31+
CommandBarOverflowItemsDirective,
32+
} from './directives/command-bar-items.directives';
1433

1534
@Component({
1635
selector: 'fab-command-bar',
@@ -195,17 +214,17 @@ export class FabCommandBarComponent extends ReactWrapperComponent<ICommandBarPro
195214
return Object.assign(
196215
{},
197216
sharedProperties,
198-
iconRenderer && {
199-
onRenderIcon: (item: IContextualMenuItem) => iconRenderer({ contextualMenuItem: item }),
200-
} as any /* NOTE: Fix for wrong typings of `onRenderIcon` in office-ui-fabric-react */,
217+
iconRenderer &&
218+
({
219+
onRenderIcon: (item: IContextualMenuItem) => iconRenderer({ contextualMenuItem: item }),
220+
} as any) /* NOTE: Fix for wrong typings of `onRenderIcon` in office-ui-fabric-react */,
201221
renderer &&
202222
({ onRender: (item, dismissMenu) => renderer({ item, dismissMenu }) } as Pick<ICommandBarItemProps, 'onRender'>)
203223
) as ICommandBarItemProps;
204224
}
205225
}
206226

207227
export interface ICommandBarItemOptions<TData = any> extends Omit<ICommandBarItemProps, 'onRender' | 'onRenderIcon'> {
208-
readonly [propertyName: string]: any;
209228
readonly renderIcon?: InputRendererOptions<ICommandBarItemOptionsRenderIconContext>;
210229
readonly render?: InputRendererOptions<ICommandBarItemOptionsRenderContext>;
211230
readonly data?: TData;

0 commit comments

Comments
 (0)