【问题标题】:Enzyme - TS2350: Only a void function can be called with the 'new' keyword酶 - TS2350:只能使用 'new' 关键字调用 void 函数
【发布时间】:2019-07-21 06:55:53
【问题描述】:

配置后:

import * as enzyme from 'enzyme';
import * as Adapter from 'enzyme-adapter-react-16';

enzyme.configure({ adapter: new Adapter() });

运行jest --watch 时,一切正常。但是,当运行webpack --watch 时,我得到: TS2350: Only a void function can be called with the 'new' keyword.

我找不到解决方案,也不明白出了什么问题。

我很想得到帮助。 谢谢。

【问题讨论】:

  • 改用import Adapter from 'enzyme-adapter-react-16';

标签: reactjs typescript jestjs enzyme


【解决方案1】:

我错过了yarn add @types/enzyme-adapter-react-16

这样就解决了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-15
    • 2020-02-26
    • 2015-08-21
    • 2021-04-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多