From 27a49c17196b0abe9308e3ba538b7da2d418a96b Mon Sep 17 00:00:00 2001 From: Kamil Owczarz Date: Wed, 6 Sep 2023 15:44:26 +0200 Subject: [PATCH] Fix lint --- src/libs/ControlSelection/index.ts | 9 +++++---- src/libs/ControlSelection/types.ts | 6 +++--- src/types/utils/CustomRefObject.ts | 5 +++++ 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 src/types/utils/CustomRefObject.ts diff --git a/src/libs/ControlSelection/index.ts b/src/libs/ControlSelection/index.ts index 4616701a55df..9625b4e49787 100644 --- a/src/libs/ControlSelection/index.ts +++ b/src/libs/ControlSelection/index.ts @@ -1,4 +1,5 @@ import ControlSelectionModule from './types'; +import CustomRefObject from '../../types/utils/CustomRefObject'; /** * Block selection on the whole app @@ -19,8 +20,8 @@ function unblock() { /** * Block selection on particular element */ -function blockElement(ref) { - if (ref === null) { +function blockElement(ref?: CustomRefObject | null) { + if (!ref) { return; } @@ -31,8 +32,8 @@ function blockElement(ref) { /** * Unblock selection on particular element */ -function unblockElement(ref) { - if (ref === null) { +function unblockElement(ref?: CustomRefObject | null) { + if (!ref) { return; } diff --git a/src/libs/ControlSelection/types.ts b/src/libs/ControlSelection/types.ts index 156fa25d27a1..5706a4981d30 100644 --- a/src/libs/ControlSelection/types.ts +++ b/src/libs/ControlSelection/types.ts @@ -1,10 +1,10 @@ -import {RefObject} from 'react'; +import CustomRefObject from '../../types/utils/CustomRefObject'; type ControlSelectionModule = { block: () => void; unblock: () => void; - blockElement: (ref?: RefObject | null) => void; - unblockElement: (ref?: RefObject | null) => void; + blockElement: (ref?: CustomRefObject | null) => void; + unblockElement: (ref?: CustomRefObject | null) => void; }; export default ControlSelectionModule; diff --git a/src/types/utils/CustomRefObject.ts b/src/types/utils/CustomRefObject.ts new file mode 100644 index 000000000000..aa726d7a0f86 --- /dev/null +++ b/src/types/utils/CustomRefObject.ts @@ -0,0 +1,5 @@ +import {RefObject} from 'react'; + +type CustomRefObject = RefObject & {onselectstart: () => boolean}; + +export default CustomRefObject;