Skip to content

Commit

Permalink
commitlint/fpHelpers: NonNullable in IsInstanceOf
Browse files Browse the repository at this point in the history
But we keep the null checks just in case.
  • Loading branch information
knocte committed Sep 11, 2024
1 parent aed7a80 commit d5508fc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion commitlint/fpHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any>,
type: NonNullable<any>
) {
if (TypeHelpers.IsNullOrUndefined(variable)) {
throw new Error(
"Invalid 'variable' parameter passed in: null or undefined"
Expand Down

0 comments on commit d5508fc

Please sign in to comment.