improve types for void callbacks

This commit is contained in:
Andre Staltz 2023-09-26 15:30:48 +03:00
parent 0d9ce50cfe
commit fec2b46a3e
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 6 additions and 7 deletions

View File

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