Repository: shipshapecode/shepherd (language: javascript)

Issue:
Mismatch between evented off implementation and type signature
The off function in evented can handle the case where the second parameter is undefined. But the type of the function is `off(event: string, handler: AnyHandler): this;`

Shouldn't it be `off(event: string, handler?: AnyHandler): this;`?

There was a similar fix when this package used JS and separate TS types: #1758

If yes I can create a PR for this.


Discussion / hints:
Yes, you are correct. Please feel free to open a PR!

Fix patch:
diff --git a/shepherd.js/src/evented.ts b/shepherd.js/src/evented.ts
index 396fb6464..95f55500f 100644
--- a/shepherd.js/src/evented.ts
+++ b/shepherd.js/src/evented.ts
@@ -50,7 +50,7 @@ export class Evented {
    * @param {Function} handler
    * @returns
    */
-  off(event: string, handler: AnyHandler) {
+  off(event: string, handler?: AnyHandler) {
     if (isUndefined(this.bindings) || isUndefined(this.bindings[event])) {
       return this;
     }


Test patch: