I just ran into this myself and code quality checks were yelling at me. I needed forwardRef in a mock but, as you ran into, await vi.importActual('react')
was unknown;
solution
import React from 'react';
vi.mock('my-module', async () => {
const { forwardRef } = await vi.importActual<typeof React>('react');
...
});
So, if you have a type definition for that module, you can just use that, but it wont infer.