Boolean prefix (ARCH3007)
Esta página aún no está disponible en tu idioma.
Key typescript.naming.boolean-prefix · Severity info · Category naming
Boolean-typed members and accessors should carry an interrogative prefix (is/has/can/should). Without one, conditionals read unnaturally and intent becomes unclear.
Incorrect
Section titled “Incorrect”class User { active: boolean = false; admin: boolean = false;
delete(): boolean { return this.admin; }}Correct
Section titled “Correct”class User { isActive: boolean = false; isAdmin: boolean = false;
canDelete(): boolean { return this.isAdmin; }}Add an appropriate interrogative prefix to the boolean member: is, has, can, or should.