mirror of https://codeberg.org/pzp/pzp-db.git
improve types for void callbacks
This commit is contained in:
parent
0d9ce50cfe
commit
fec2b46a3e
13
lib/index.js
13
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<void>} 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<void>} cb
|
||||
*/
|
||||
function erase(msgID, cb) {
|
||||
const rec = getRecord(msgID)
|
||||
|
|
Loading…
Reference in New Issue