React.Component 状态的 FlowType 注释未在编译时删除

FlowType annotation for React.Component state not being removed at compile

所以我尝试将 Flow 应用到现有的存储库中,并在将其与 React.Component 一起使用时将 运行 应用到障碍中。 documentation 表明您应该通过放置在组件的开头来注释组件的状态对象。这样做满足 Flow,我不再有任何错误。但是代码不会编译。 Babel 现在每次编译这个组件都会出错。我尝试使用内置于 babel react 预设中的 Flow 支持以及包括 babel transform-flow-strip-types 插件。所有其他注释都被毫无问题地删除,但由于某种原因,这个不是。这是插件中的错误还是我做错了什么?

class MyComponent extends React.Component {
    state: {someKey: {withSomeMoreKeys: string}};

    constructor(props: void): void{
        super(props);

        this.state = {
            someKey: {
                withSomeMoreKeys: string
            }
        }
    }
    ...

感谢您的帮助!

确保您已启用 class properties Babel 插件