【问题标题】:Getting "expected call-signature: 'printMe' to have a typedef" and I can't get rid of it获得“预期的呼叫签名:'printMe' 有一个 typedef”,我无法摆脱它
【发布时间】:2019-06-11 07:04:13
【问题描述】:

我有一个简单的函数:

export function printMe() : number {
    console.log("Print me...");
    return 1;
}

我得到这个 linting 错误:

WARNING in ./src/print.ts
Module Warning (from ./node_modules/tslint-loader/index.js):
[1, 17]: expected call-signature: 'printMe' to have a typedef

它有什么问题?我宁愿把它做​​对,也不愿禁用规则。

【问题讨论】:

  • 不应该是number而不是Number吗?
  • @mbj 当然是。谢谢。同样的问题......

标签: webpack tslint


【解决方案1】:

想通了。 lint 配置必须是 webpack 配置中的单独规则。比如

...
module: {
    rules: [
      {
        test: /\.tsx?$/,
        enforce: 'pre',
        use: [
            {
                loader: 'tslint-loader',
                options: { /* Loader options go here */ }
            }
        ],
        exclude: /node_modules/
      }, {
        test: /\.tsx?$/,
        use: ['ts-loader'],
        exclude: /node_modules/
      }
    ]
}
...

【讨论】:

  • 啊,有趣。修好之前是什么样子的?
猜你喜欢
  • 2018-10-10
  • 2021-03-14
  • 2021-08-18
  • 1970-01-01
  • 2017-01-28
  • 1970-01-01
  • 2018-03-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多