Skip to content

Commit 1838990

Browse files
committed
chore: Convert helpers.js to TypeScript
1 parent 4f965e9 commit 1838990

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/helpers.js renamed to src/helpers.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function jestFakeTimersAreEnabled() {
77
if (typeof jest !== 'undefined' && jest !== null) {
88
return (
99
// legacy timers
10-
setTimeout._isMockFunction === true ||
10+
(setTimeout as any)._isMockFunction === true ||
1111
// modern timers
1212
Object.prototype.hasOwnProperty.call(setTimeout, 'clock')
1313
)
@@ -23,7 +23,7 @@ function getDocument() {
2323
}
2424
return window.document
2525
}
26-
function getWindowFromNode(node) {
26+
function getWindowFromNode(node: any) {
2727
if (node.defaultView) {
2828
// node is document
2929
return node.defaultView
@@ -60,11 +60,11 @@ function getWindowFromNode(node) {
6060
}
6161
}
6262

63-
function checkContainerType(container) {
63+
function checkContainerType(container: unknown) {
6464
if (
6565
!container ||
66-
!(typeof container.querySelector === 'function') ||
67-
!(typeof container.querySelectorAll === 'function')
66+
!(typeof (container as any).querySelector === 'function') ||
67+
!(typeof (container as any).querySelectorAll === 'function')
6868
) {
6969
throw new TypeError(
7070
`Expected container to be an Element, a Document or a DocumentFragment but got ${getTypeName(
@@ -73,7 +73,7 @@ function checkContainerType(container) {
7373
)
7474
}
7575

76-
function getTypeName(object) {
76+
function getTypeName(object: unknown) {
7777
if (typeof object === 'object') {
7878
return object === null ? 'null' : object.constructor.name
7979
}

0 commit comments

Comments
 (0)