From 2aebbdc6160476809cf9f045a89efb0b55ec8953 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Wed, 31 Jan 2024 14:57:38 +0100 Subject: [PATCH 1/3] migrate react-freeze mock to TypeScript --- __mocks__/react-freeze.js | 6 ------ __mocks__/react-freeze.ts | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) delete mode 100644 __mocks__/react-freeze.js create mode 100644 __mocks__/react-freeze.ts diff --git a/__mocks__/react-freeze.js b/__mocks__/react-freeze.js deleted file mode 100644 index 51294f40f9ca..000000000000 --- a/__mocks__/react-freeze.js +++ /dev/null @@ -1,6 +0,0 @@ -const Freeze = (props) => props.children; - -export { - // eslint-disable-next-line import/prefer-default-export - Freeze, -}; diff --git a/__mocks__/react-freeze.ts b/__mocks__/react-freeze.ts new file mode 100644 index 000000000000..b3952c48bdc6 --- /dev/null +++ b/__mocks__/react-freeze.ts @@ -0,0 +1,8 @@ +import type ChildrenProps from '@src/types/utils/ChildrenProps'; + +const Freeze = (props: ChildrenProps) => props.children; + +export { + // eslint-disable-next-line import/prefer-default-export + Freeze, +}; From 958769b0ca2181a6d1d52320095717e9006056c8 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Thu, 1 Feb 2024 14:14:45 +0100 Subject: [PATCH 2/3] add more accurate types --- __mocks__/react-freeze.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/__mocks__/react-freeze.ts b/__mocks__/react-freeze.ts index b3952c48bdc6..0c6e252e598d 100644 --- a/__mocks__/react-freeze.ts +++ b/__mocks__/react-freeze.ts @@ -1,8 +1,11 @@ -import type ChildrenProps from '@src/types/utils/ChildrenProps'; +import type {Freeze} from 'react-freeze'; -const Freeze = (props: ChildrenProps) => props.children; +type ReactFreezeMock = { + Freeze: typeof Freeze; +}; -export { - // eslint-disable-next-line import/prefer-default-export - Freeze, +const reactFreezeMock: ReactFreezeMock = { + Freeze: (props) => props.children as JSX.Element, }; + +export default reactFreezeMock; From 7351e840f01b64e8259b8901f544ebb9f8d45470 Mon Sep 17 00:00:00 2001 From: Julian Kobrynski Date: Wed, 7 Feb 2024 14:01:43 +0100 Subject: [PATCH 3/3] fix export problem --- __mocks__/react-freeze.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/__mocks__/react-freeze.ts b/__mocks__/react-freeze.ts index 0c6e252e598d..d87abe01acfb 100644 --- a/__mocks__/react-freeze.ts +++ b/__mocks__/react-freeze.ts @@ -1,11 +1,8 @@ -import type {Freeze} from 'react-freeze'; +import type {Freeze as FreezeComponent} from 'react-freeze'; -type ReactFreezeMock = { - Freeze: typeof Freeze; -}; +const Freeze: typeof FreezeComponent = (props) => props.children as JSX.Element; -const reactFreezeMock: ReactFreezeMock = { - Freeze: (props) => props.children as JSX.Element, +export { + // eslint-disable-next-line import/prefer-default-export + Freeze, }; - -export default reactFreezeMock;