79476710

Date: 2025-02-28 21:19:29
Score: 0.5
Natty:
Report link

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.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Bastiat