Make more of the codebase conform to strict types (#10857)
This commit is contained in:
parent
7f017a84c2
commit
6a3f59cc76
45 changed files with 127 additions and 121 deletions
|
@ -302,7 +302,7 @@ interface IState {
|
|||
* tooltip along one edge of the target.
|
||||
*/
|
||||
export default class InteractiveTooltip extends React.Component<IProps, IState> {
|
||||
private target: HTMLElement;
|
||||
private target?: HTMLElement;
|
||||
|
||||
public static defaultProps = {
|
||||
side: Direction.Top,
|
||||
|
@ -345,6 +345,7 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
|
|||
|
||||
private onLeftOfTarget(): boolean {
|
||||
const { contentRect } = this.state;
|
||||
if (!this.target) return false;
|
||||
const targetRect = this.target.getBoundingClientRect();
|
||||
|
||||
if (this.props.direction === Direction.Left) {
|
||||
|
@ -359,6 +360,7 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
|
|||
|
||||
private aboveTarget(): boolean {
|
||||
const { contentRect } = this.state;
|
||||
if (!this.target) return false;
|
||||
const targetRect = this.target.getBoundingClientRect();
|
||||
|
||||
if (this.props.direction === Direction.Top) {
|
||||
|
@ -378,7 +380,7 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
|
|||
private onMouseMove = (ev: MouseEvent): void => {
|
||||
const { clientX: x, clientY: y } = ev;
|
||||
const { contentRect } = this.state;
|
||||
if (!contentRect) return;
|
||||
if (!contentRect || !this.target) return;
|
||||
const targetRect = this.target.getBoundingClientRect();
|
||||
|
||||
let direction: Direction;
|
||||
|
@ -423,6 +425,8 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
|
|||
return null;
|
||||
}
|
||||
|
||||
if (!this.target) return null;
|
||||
|
||||
const targetRect = this.target.getBoundingClientRect();
|
||||
|
||||
// The window X and Y offsets are to adjust position when zoomed in to page
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue