This is a simple test using a mocked function. But I do get an ts error for the mock call Object is possibly 'undefined'.ts(2532). I don't see how to get rid of this error. This is the structure of the call object, so I think I handle it correctly... but obviously not as expected by ts.
import { render, fireEvent } from '@testing-library/react'
const mockSetCheckbox = jest.fn(() => Promise.resolve())
test('should select checkbox', () => {
// ...
userEvent.click(checkbox)
expect(mockSetCheckbox.mock.calls[0][0].variables.input.checkbox).toBe(true)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Object is possibly 'undefined'.ts(2532)
})