【发布时间】:2021-02-01 16:26:02
【问题描述】:
为什么从以下位置升级后:
"@typescript-eslint/eslint-plugin": "^4.13.0",
"@typescript-eslint/parser": "^4.13.0",
到:
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
eslint 已开始在下面的类中标记(用 Typescript 编写)currentPalette 未定义 [eslint(no-undef)],它充当whichPalette 的默认参数?
class Colormap {
private currentPalette: string;
getColors(numberColors: number, whichPalette = this.currentPalette): string[] {
const colors = palette(whichPalette, numberColors);
return colors.map((color) => `#${color}`);
}
}
感谢您的澄清!
【问题讨论】:
-
好吧,它没有值
-
初始化
currentPalette并不能解决问题。对不起。
标签: typescript eslint