diff --git a/lib/index.js b/lib/index.js index 6d6e22e..3fc8d7f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -62,11 +62,10 @@ const { decrypt } = require('./encryption') /** * @template T - * @typedef {(...args: [Error] | [null, T]) => void} CB - */ - -/** - * @typedef {(...args: [Error] | []) => void} CBVoid + * @typedef {T extends void ? + * (...args: [Error] | []) => void : + * (...args: [Error] | [null, T]) => void + * } CB */ class DBTangle extends MsgV3.Tangle { @@ -916,7 +915,7 @@ function initDB(peer, config) { /** * @param {string} msgID - * @param {CBVoid} cb + * @param {CB} cb */ function del(msgID, cb) { const rec = getRecord(msgID) @@ -931,7 +930,7 @@ function initDB(peer, config) { /** * @param {string} msgID - * @param {CBVoid} cb + * @param {CB} cb */ function erase(msgID, cb) { const rec = getRecord(msgID)