From 7413819b7b5e20238c87091f22f22665f4cef8eb Mon Sep 17 00:00:00 2001 From: Irakli Gozalishvili Date: Fri, 11 Dec 2020 11:07:14 -0800 Subject: [PATCH] fix: turn isCID to a type guard This fixes regression caused by switch to generated typedefs which turned `isCID` to non type guard predicate. For details on type guards see: https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 2132540..99a6e78 100644 --- a/src/index.js +++ b/src/index.js @@ -334,7 +334,7 @@ class CID { * Check if object is a CID instance * * @param {any} value - * @returns {boolean} + * @returns {value is CID} */ static isCID (value) { return value instanceof CID || Boolean(value && value[symbol])