From e9ddb7ec0eb60af12a0e4da5a77929126cf1c9ab Mon Sep 17 00:00:00 2001 From: achingbrain Date: Sun, 6 Feb 2022 11:21:02 +0000 Subject: [PATCH] fix: add return to toOptions Adds return type that constrains family to 4 or 6 --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 79cb3513..8b0d58fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -116,10 +116,10 @@ export class Multiaddr { * // { family: 4, host: '127.0.0.1', transport: 'tcp', port: 4001 } * ``` */ - toOptions () { + toOptions (): MultiaddrObject { const parsed = this.toString().split('/') - const opts = { + const opts: MultiaddrObject = { family: parsed[1] === 'ip4' ? 4 : 6, host: parsed[2], transport: parsed[3],