From 67401eeb273ebca80f07276e0b2bf92b62433c72 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Fri, 22 Sep 2023 10:11:18 +0100 Subject: [PATCH] Remove the code style rule about casts to bool --- code_style.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/code_style.md b/code_style.md index c1c9beda78..6f6812de91 100644 --- a/code_style.md +++ b/code_style.md @@ -113,17 +113,6 @@ Unless otherwise specified, the following applies to all code: } ``` -14. Explicitly cast to a boolean, rather than relying on implicit truthiness of non-boolean values: - - ```typescript - const isRealUser = !!userId && ...; - // ... or ... - const isRealUser = Boolean(userId) && ...; - - // but *not*: - const isRealUser = userId && ...; // invalid implicit cast - ``` - 15. Use `switch` statements when checking against more than a few enum-like values. 16. Use `const` for constants, `let` for mutability. 17. Describe types exhaustively (ensure noImplictAny would pass).