React renderIntoDocument

I am getting several (what I believe to be) false-positives for React unit testing using the renderIntoDocument() function, using SonarQube and SonarScanner

it('will render with assign icon ', async () => {
        const document: any = ReactTestUtils.renderIntoDocument(<AssignButtonField {...props} {...reduxProps} />);
        const icon = ReactTestUtils.scryRenderedDOMComponentsWithClass(document, 'fa fa-sign-out-alt');

Rule being triggered: typescript:S3699

Hi @GreenDavidA,

From its type definition, it looks like renderIntoDocument may return void

export function renderIntoDocument<P>( element: ReactElement<P>): Component<P> | Element | void;

Inside our rule implementation, we are using the TypeScript compiler API to determine what is the return type of renderIntoDocument, so I suspect TypeScript compiler itself is inferring that document may have type void.

I’d suggest to remove the any type declaration, and verify what is the type inferred by the compiler.