Skip to content

Commit

Permalink
GroupHeader: tighten typings (#8484)
Browse files Browse the repository at this point in the history
* tighten newProps type

* change file
  • Loading branch information
natalieethell authored and dzearing committed Mar 27, 2019
1 parent 5ad8b88 commit 856dbd5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "GroupHeader: tighten componentWillReceiveProps parameter typing",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "[email protected]"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ export class GroupHeaderBase extends React.Component<IGroupHeaderProps, IGroupHe
};
}

public componentWillReceiveProps(newProps: any): void {
public componentWillReceiveProps(newProps: IGroupHeaderProps): void {
if (newProps.group) {
const newCollapsed = newProps.group.isCollapsed;
const isGroupLoading = newProps.headerProps && newProps.headerProps.isGroupLoading;
const isGroupLoading = newProps.isGroupLoading;
const newLoadingVisible = !newCollapsed && isGroupLoading && isGroupLoading(newProps.group);

this.setState({
isCollapsed: newCollapsed,
isLoadingVisible: newLoadingVisible
isCollapsed: newCollapsed || false,
isLoadingVisible: newLoadingVisible || false
});
}
}
Expand Down

0 comments on commit 856dbd5

Please sign in to comment.