From e5e5f5771267f594beb93bb12621fc44e8fca22b Mon Sep 17 00:00:00 2001 From: Alex Potsides Date: Sun, 6 Feb 2022 11:31:17 +0000 Subject: [PATCH] fix: add return to toOptions (#223) 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],