Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#71537 Fix typing of addKeyBinding() for re…
Browse files Browse the repository at this point in the history
…veal.js by @kcooney
  • Loading branch information
kcooney authored Jan 25, 2025
1 parent f5afe14 commit 05315e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions types/reveal.js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,8 @@ declare namespace Reveal {
* @param callback
*/
addKeyBinding(
binding: string | { keyCode: number; key: string; description: string },
callback: (event: KeyboardEvent) => void,
keyCode: number | { keyCode: number; key: string; description: string },
callback: string | ((event: KeyboardEvent) => void),
): void;

/**
Expand Down
5 changes: 4 additions & 1 deletion types/reveal.js/reveal.esm.js-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,10 @@ deck.hasNavigatedVertically();
// Adds/removes a custom key binding

// $ExpectType void
deck.addKeyBinding("enter", () => {});
deck.addKeyBinding(82, () => {});

// $ExpectType void
deck.addKeyBinding(82, "next");

// $ExpectType void
deck.addKeyBinding({ keyCode: 1, key: "enter", description: "description" }, () => {});
Expand Down
5 changes: 4 additions & 1 deletion types/reveal.js/reveal.js-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,10 @@ deck.hasNavigatedVertically();
// Adds/removes a custom key binding

// $ExpectType void
deck.addKeyBinding("enter", () => {});
deck.addKeyBinding(82, () => {});

// $ExpectType void
deck.addKeyBinding(82, "next");

// $ExpectType void
deck.addKeyBinding({ keyCode: 1, key: "enter", description: "description" }, () => {});
Expand Down

0 comments on commit 05315e4

Please sign in to comment.