Enforce correct use of numbers.
You are advised to modify the code to comply with the ArkTS Performant Programming Practices.
// code-linter.json5
{
"rules": {
"@performance/number-init-check": "suggestion",
}
} let intNum = 1; // intNum is declared as int. Avoid changing it to float. intNum = 1.1; let floatNum = 1.3; // floatNum is declared as float. Avoid changing it to int. floatNum = 2;
plugin:@performance/all
For details about how to configure Code Linter check rules, see Code Linter.