'TypeScript error setting a component into the rootComponent option in single-spa

I've an error that the type I am passing to the rootComponent option is not compatible. I create a simple component in react and then pass it to SingleSpaReactOpts to allocate it inside the singleSpaReact function.
Creating a simple project in react with typescript and add single-spa and single-spa-rect dependencies. I'm using single-spa to use the navigateToUrl method in my navbar. Then create a component like this class NavBar extends React.Component { and configure the singleSpaReact like this:

const headerLifecycles = singleSpaReact({
  React,
  ReactDOM,
  rootComponent: NavBar, // here shows an typescript error
  errorBoundary(err, errInfo, props) {
    return <div>error</div>;
  },
});

Doing some research, I realized that by removing the single-spa dependency the error disappears.

I've uploaded an example where the error is reproduced https://github.com/j1cs/wp5-mf-single-spa

Issue in github https://github.com/single-spa/single-spa/issues/931 hoping to someone respond



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source