summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tests/unit/urlpattern_test.ts5
-rw-r--r--cli/tsc/dts/lib.dom.extras.d.ts2
-rw-r--r--ext/url/lib.deno_url.d.ts2
3 files changed, 7 insertions, 2 deletions
diff --git a/cli/tests/unit/urlpattern_test.ts b/cli/tests/unit/urlpattern_test.ts
index 9bed09235..cb5fc76c5 100644
--- a/cli/tests/unit/urlpattern_test.ts
+++ b/cli/tests/unit/urlpattern_test.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { assert, assertEquals } from "./test_util.ts";
+import { assertType, IsExact } from "../../../test_util/std/testing/types.ts";
Deno.test(function urlPatternFromString() {
const pattern = new URLPattern("https://deno.land/foo/:bar");
@@ -13,6 +14,10 @@ Deno.test(function urlPatternFromString() {
assert(match);
assertEquals(match.pathname.input, "/foo/x");
assertEquals(match.pathname.groups, { bar: "x" });
+
+ // group values should be nullable
+ const val = match.pathname.groups.val;
+ assertType<IsExact<typeof val, string | undefined>>(true);
});
Deno.test(function urlPatternFromStringWithBase() {
diff --git a/cli/tsc/dts/lib.dom.extras.d.ts b/cli/tsc/dts/lib.dom.extras.d.ts
index 2c593b2cb..9116596a6 100644
--- a/cli/tsc/dts/lib.dom.extras.d.ts
+++ b/cli/tsc/dts/lib.dom.extras.d.ts
@@ -23,7 +23,7 @@ declare type URLPatternInput = string | URLPatternInit;
declare interface URLPatternComponentResult {
input: string;
- groups: Record<string, string>;
+ groups: Record<string, string | undefined>;
}
/** `URLPatternResult` is the object returned from `URLPattern.exec`. */
diff --git a/ext/url/lib.deno_url.d.ts b/ext/url/lib.deno_url.d.ts
index 1d5f84019..9a8c155d9 100644
--- a/ext/url/lib.deno_url.d.ts
+++ b/ext/url/lib.deno_url.d.ts
@@ -206,7 +206,7 @@ declare type URLPatternInput = string | URLPatternInit;
/** @category Web APIs */
declare interface URLPatternComponentResult {
input: string;
- groups: Record<string, string>;
+ groups: Record<string, string | undefined>;
}
/** `URLPatternResult` is the object returned from `URLPattern.exec`.