Skip to content

Commit 9a63752

Browse files
fix: type the once-guard slot as optional
`tsc` rejected clearing it, since the slot took its type from the callback parameter and so could not hold `undefined`.
1 parent 029954b commit 9a63752

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎lib/util/async.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* @returns {(err?: E | null) => void} completion callback for a single item
1414
*/
1515
const once = (done) => {
16+
/** @type {((err?: E | null) => void) | undefined} */
1617
let pending = done;
1718
return (err) => {
1819
const fn = pending;

0 commit comments

Comments
 (0)