I want to mock fs
with vitest and I am successfully doing so, however I am using any
to do so. Consider
import { promises as fs } from 'fs';
vi.mock('fs')
it('can mock', async () => {
// Property 'mockResolvedValue' does not exist on type '{ ......
fs.readdir.mockResolvedValue([])
// ok but can we do better?
(fs.readdir as any).mockResolvedValue([])
})
How can I improve the typing here?