Javascript 更新到最新版本的react和material ui后,在redux中合成函数时出错

Javascript 更新到最新版本的react和material ui后,在redux中合成函数时出错,javascript,reactjs,typescript,react-redux,material-ui,Javascript,Reactjs,Typescript,React Redux,Material Ui,我的应用程序运行良好,直到我更新了材质ui和react软件包,突然我开始出现以下错误 src/App.tsx (156,45): Type '{}' does not satisfy the constraint ComponentType<never>. Type '{}' is not assignable to type StatelessComponent<never>. 我认为问题在于我的自定义with root函数,或者with style函数,但我

我的应用程序运行良好,直到我更新了材质uireact软件包,突然我开始出现以下错误

 src/App.tsx 
 (156,45): Type '{}' does not satisfy the constraint ComponentType<never>.
 Type '{}' is not assignable to type StatelessComponent<never>.
我认为问题在于我的自定义
with root
函数,或者
with style
函数,但我不知道现在需要什么类型,为什么不在更新库之前抛出错误。我已经删除了node_modules文件夹并重新安装了所有软件包,以检查更新是否遗漏了某些内容

这就是我如何定义我的
道具
状态
类型:

const styles = (theme: Theme) => createStyles({...});
export namespace App {
    export interface Props extends RouteComponentProps<void>, WithStyles<typeof styles>, WithWidth {
        layout: Layout;
        history: any;
    }

    export interface State {
        mobileOpen: boolean;
    }
}

class App extends React.Component<App.Props, App.State> {
...
}

也许这有助于复制这个问题,我开始我的项目时使用了这个项目的大部分想法。

您是否尝试过不指定类型?i、 e.
withStyles(styles)(connect…
Yes,它抛出了一个不同的错误:
Type'Props'不满足约束'ComponentType'。类型“Props”不可分配给类型“StatelessComponent”。
我无法再现错误,可能是因为我缺少了
MapStateTrops
函数。虽然人们有时可以在不实际编译代码的情况下发现问题,但确保问题中的代码足以让人们在需要时重现问题始终是一个好主意。是的,我知道没有原始代码很难重现问题,但这是一个大项目,将代码简化为测试项目以复制问题有点困难,我希望有人以前见过这个错误;)。如果你愿意,我可以共享
MapStateTops
,但我认为这不会有什么帮助,这是非常标准的,我只是从
ApplicationState
@MattMcCutchen映射了一个字段,我在帖子末尾添加了一个GitHub存储库,可以帮助重现错误,App.tsx有相同的
导出
"@material-ui/core": "^3.2.1",
"@material-ui/icons": "^3.0.1",
"react": "16.5.2", 
"react-dom": "16.5.2",
const styles = (theme: Theme) => createStyles({...});
export namespace App {
    export interface Props extends RouteComponentProps<void>, WithStyles<typeof styles>, WithWidth {
        layout: Layout;
        history: any;
    }

    export interface State {
        mobileOpen: boolean;
    }
}

class App extends React.Component<App.Props, App.State> {
...
}
function withRoot(Component: React.ComponentType) {
  function WithRoot() {
    // MuiThemeProvider makes the theme available down the React tree
    // thanks to React context.
    return (
      <MuiThemeProvider theme={theme}>
        {/* Reboot kickstart an elegant, consistent, and simple baseline to build upon. */}
        <CssBaseline />
        <Component {...props} />
      </MuiThemeProvider>
    );
  }

  return WithRoot;
}