diff --git a/package.json b/package.json index 6881c899..a1cb7c03 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,9 @@ "plugin:import/typescript" ], "rules": { + "@typescript-eslint/prefer-optional-chain": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unsafe-member-access": "off", "@typescript-eslint/prefer-includes": "off", "import/prefer-default-export": "off", "import/no-unassigned-import": "off", diff --git a/src/helpers.js b/src/helpers.ts similarity index 88% rename from src/helpers.js rename to src/helpers.ts index ed356592..5a068300 100644 --- a/src/helpers.js +++ b/src/helpers.ts @@ -4,10 +4,11 @@ const TEXT_NODE = 3 function jestFakeTimersAreEnabled() { /* istanbul ignore else */ + // eslint-disable-next-line if (typeof jest !== 'undefined' && jest !== null) { return ( // legacy timers - setTimeout._isMockFunction === true || + (setTimeout as any)._isMockFunction === true || // modern timers Object.prototype.hasOwnProperty.call(setTimeout, 'clock') ) @@ -23,7 +24,7 @@ function getDocument() { } return window.document } -function getWindowFromNode(node) { +function getWindowFromNode(node: any) { if (node.defaultView) { // node is document return node.defaultView @@ -60,11 +61,11 @@ function getWindowFromNode(node) { } } -function checkContainerType(container) { +function checkContainerType(container: unknown) { if ( !container || - !(typeof container.querySelector === 'function') || - !(typeof container.querySelectorAll === 'function') + !(typeof (container as any).querySelector === 'function') || + !(typeof (container as any).querySelectorAll === 'function') ) { throw new TypeError( `Expected container to be an Element, a Document or a DocumentFragment but got ${getTypeName( @@ -73,7 +74,7 @@ function checkContainerType(container) { ) } - function getTypeName(object) { + function getTypeName(object: unknown) { if (typeof object === 'object') { return object === null ? 'null' : object.constructor.name }