From d5508fc7771f8bad950c13e1c3b2c10e7182ae31 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Wed, 11 Sep 2024 10:02:25 +0800 Subject: [PATCH 1/2] commitlint/fpHelpers: NonNullable in IsInstanceOf But we keep the null checks just in case. --- commitlint/fpHelpers.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commitlint/fpHelpers.ts b/commitlint/fpHelpers.ts index 3b7de9c5..74fc3bce 100644 --- a/commitlint/fpHelpers.ts +++ b/commitlint/fpHelpers.ts @@ -56,7 +56,10 @@ export class TypeHelpers { } // because instanceof doesn't work with primitive types (e.g. String), taken from https://stackoverflow.com/a/58184883/544947 - public static IsInstanceOf(variable: any, type: any) { + public static IsInstanceOf( + variable: NonNullable, + type: NonNullable + ) { if (TypeHelpers.IsNullOrUndefined(variable)) { throw new Error( "Invalid 'variable' parameter passed in: null or undefined" From 0b5824828efdbe5931a4b139e983a7e32bd84739 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Wed, 11 Sep 2024 10:21:11 +0800 Subject: [PATCH 2/2] docs: removes unnecessary else block from snippet --- docs/WorkflowGuidelines.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/WorkflowGuidelines.md b/docs/WorkflowGuidelines.md index a5f2f35f..df2564cb 100644 --- a/docs/WorkflowGuidelines.md +++ b/docs/WorkflowGuidelines.md @@ -192,10 +192,7 @@ { return 0; } - else - { - return 1; - } + return 1; ``` Improved code: