Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kowczarz committed Sep 6, 2023
1 parent 6734257 commit 27a49c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/libs/ControlSelection/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ControlSelectionModule from './types';
import CustomRefObject from '../../types/utils/CustomRefObject';

/**
* Block selection on the whole app
Expand All @@ -19,8 +20,8 @@ function unblock() {
/**
* Block selection on particular element
*/
function blockElement(ref) {
if (ref === null) {
function blockElement<T>(ref?: CustomRefObject<T> | null) {
if (!ref) {
return;
}

Expand All @@ -31,8 +32,8 @@ function blockElement(ref) {
/**
* Unblock selection on particular element
*/
function unblockElement(ref) {
if (ref === null) {
function unblockElement<T>(ref?: CustomRefObject<T> | null) {
if (!ref) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/libs/ControlSelection/types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {RefObject} from 'react';
import CustomRefObject from '../../types/utils/CustomRefObject';

type ControlSelectionModule = {
block: () => void;
unblock: () => void;
blockElement: <T>(ref?: RefObject<T> | null) => void;
unblockElement: <T>(ref?: RefObject<T> | null) => void;
blockElement: <T>(ref?: CustomRefObject<T> | null) => void;
unblockElement: <T>(ref?: CustomRefObject<T> | null) => void;
};

export default ControlSelectionModule;
5 changes: 5 additions & 0 deletions src/types/utils/CustomRefObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {RefObject} from 'react';

type CustomRefObject<T> = RefObject<T> & {onselectstart: () => boolean};

export default CustomRefObject;

0 comments on commit 27a49c1

Please sign in to comment.