'how to add type annotation for mock function

I have two mocked functions named mockedUnload and mockedMiniApp in test.tsx file;

let mockedUnload;
let mockedMiniApp; 

beforeEach(() => { 
   mockedUnload = jest.fn(() => Promise.resolve()); 
   mockedMiniApp = jest.fn(() => Promise.resolve({unload: mockedUnload}));
};

Obviously, the type of mockedUnload and mockedMiniApp is any. It maybe not a good practise, but I don't know what the type annotation I should assign to mockedUnload and mockedMiniApp. BTW, I have to wrapp these two functions into beforeEach for some reasons. Thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source