From e4e0f4d435a27619d58626438e2d9ba25993ab34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:32:36 +0900 Subject: [PATCH 1/3] enhance(types): Narrow down type definition of subnetMatch --- lib/ipaddr.js.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ipaddr.js.d.ts b/lib/ipaddr.js.d.ts index 62afab3..ae9c2e7 100644 --- a/lib/ipaddr.js.d.ts +++ b/lib/ipaddr.js.d.ts @@ -22,7 +22,7 @@ declare module "ipaddr.js" { export function parse(addr: string): IPv4 | IPv6; export function parseCIDR(mask: string): [IPv4 | IPv6, number]; export function process(addr: string): IPv4 | IPv6; - export function subnetMatch(addr: IPv4 | IPv6, rangeList: RangeList, defaultName?: string): string; + export function subnetMatch, D extends string = "unicast">(addr: IPv4 | IPv6, rangeList: L, defaultName?: D): keyof L | D; export class IPv4 extends IP { static broadcastAddressFromCIDR(addr: string): IPv4; @@ -40,7 +40,7 @@ declare module "ipaddr.js" { kind(): 'ipv4'; match(what: IPv4 | IPv6 | [IPv4 | IPv6, number], bits?: number): boolean; range(): IPv4Range; - subnetMatch(rangeList: RangeList, defaultName?: string): string; + subnetMatch, D extends string = "unicast">(rangeList: RangeList, defaultName?: D): keyof L | D; toIPv4MappedAddress(): IPv6; } @@ -61,7 +61,7 @@ declare module "ipaddr.js" { kind(): 'ipv6'; match(what: IPv4 | IPv6 | [IPv4 | IPv6, number], bits?: number): boolean; range(): IPv6Range; - subnetMatch(rangeList: RangeList, defaultName?: string): string; + subnetMatch, D extends string = "unicast">(rangeList: L, defaultName?: D): keyof L | D; toIPv4Address(): IPv4; toRFC5952String(): string; } From 6c1dfc7c0eec43c1bcad612009991699113b8366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:33:22 +0900 Subject: [PATCH 2/3] fix --- lib/ipaddr.js.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ipaddr.js.d.ts b/lib/ipaddr.js.d.ts index ae9c2e7..048c6e4 100644 --- a/lib/ipaddr.js.d.ts +++ b/lib/ipaddr.js.d.ts @@ -40,7 +40,7 @@ declare module "ipaddr.js" { kind(): 'ipv4'; match(what: IPv4 | IPv6 | [IPv4 | IPv6, number], bits?: number): boolean; range(): IPv4Range; - subnetMatch, D extends string = "unicast">(rangeList: RangeList, defaultName?: D): keyof L | D; + subnetMatch, D extends string = "unicast">(rangeList: L, defaultName?: D): keyof L | D; toIPv4MappedAddress(): IPv6; } From 5809b70a484e0b07b4285aebd019b1fad68a859f Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Wed, 19 Aug 2026 10:10:07 +0900 Subject: [PATCH 3/3] chore: Use single quotes instead of double quotes --- lib/ipaddr.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ipaddr.d.ts b/lib/ipaddr.d.ts index 98a4fdc..3475761 100644 --- a/lib/ipaddr.d.ts +++ b/lib/ipaddr.d.ts @@ -20,7 +20,7 @@ export function isValidCIDR(addr: string): boolean; export function parse(addr: string): IPv4 | IPv6; export function parseCIDR(mask: string): [IPv4 | IPv6, number]; export function process(addr: string): IPv4 | IPv6; -export function subnetMatch, D extends string = "unicast">(addr: IPv4 | IPv6, rangeList: L, defaultName?: D): keyof L | D; +export function subnetMatch, D extends string = 'unicast'>(addr: IPv4 | IPv6, rangeList: L, defaultName?: D): keyof L | D; export class IPv4 extends IP { static broadcastAddressFromCIDR(addr: string): IPv4; @@ -39,7 +39,7 @@ export class IPv4 extends IP { kind(): 'ipv4'; match(what: IPv4 | IPv6 | [IPv4 | IPv6, number], bits?: number): boolean; range(): IPv4Range; - subnetMatch, D extends string = "unicast">(rangeList: L, defaultName?: D): keyof L | D; + subnetMatch, D extends string = 'unicast'>(rangeList: L, defaultName?: D): keyof L | D; toIPv4MappedAddress(): IPv6; } @@ -60,7 +60,7 @@ export class IPv6 extends IP { kind(): 'ipv6'; match(what: IPv4 | IPv6 | [IPv4 | IPv6, number], bits?: number): boolean; range(): IPv6Range; - subnetMatch, D extends string = "unicast">(rangeList: L, defaultName?: D): keyof L | D; + subnetMatch, D extends string = 'unicast'>(rangeList: L, defaultName?: D): keyof L | D; toIPv4Address(): IPv4; toRFC5952String(): string; } \ No newline at end of file