typescript - 摆脱 no-inner-declaratioins eslint 错误的最佳方法是什么?
问题描述
我正在研究以这种方式使用模块的打字稿代码库。
export module Foo {
const foos = []
export function getFoos() {
return getLastFoo();
}
function getLastFoo() {
return foos[-1]
}
}
错误截图:
我试图摆脱 no-inner-declarations eslint 错误。我想到的一种方法是用类替换模块。
export class Foo {
static foos = []
static getFoos() {
return this.getLastFoo();
}
private static getLastFoo() {
return this.foos[-1]
}
}
有没有办法解决这个 eslint 错误而不必将模块更改为类?
解决方案
推荐阅读
- javascript - 如何在 web3.js 中将 uint32[]、uint8[] 参数传递给智能合约
- oracle - PL/SQL 如何修复进程标志 id=4 错误打印以及如何显示错误消息
- wordpress - 我可以在 WordPress 中包含 PayPal 和 SSLCOMMERZ 吗?
- ruby-on-rails - rails 6 react error importing component module not found 无法解决
- python - 如何将 PDF 中的数据抓取到 Excel 中
- java - 使用带有 spring data jpa 的weld-junit 作为轻量级 arquillian 替代品的经验?
- flutter - 错误显示:多个小部件使用相同的 GlobalKey
- node.js - 如何知道 node 是否安装了 homebrew 或 nvm?
- ios - 为什么某些 Apple Wallet 生成的 QR 码包含这么多额外的垃圾?
- sql - 将 JSON 文本插入 DB2 表