no-loss-of-precision
不允許會失去精度的字面數字。
✅
延伸 "plugin:@typescript-eslint/recommended"
in an ESLint configuration enables this rule.
This rule extends the base eslint/no-loss-of-precision
rule. It adds support for numeric separators.
選項
請參閱 eslint/no-loss-of-precision
選項。
如何使用
.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"no-loss-of-precision": "off",
"@typescript-eslint/no-loss-of-precision": "error"
}
};
在操場中嘗試此規則 ↗