diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-04-26 19:15:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-26 19:15:25 -0400 |
commit | f4e442da4d948126e1db8cbb9905c5d140d94e1d (patch) | |
tree | 7379988639489c4aded65f02a3c6c565950e2a32 /cli/tests | |
parent | e2761df3fe2a457948948dcd38fb4f7e02cd350e (diff) |
fix(dts): `URLPatternComponentResult` groups should have possibly undefined key values (#18643)
Closes #18640
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/unit/urlpattern_test.ts | 5 |
1 files changed, 5 insertions, 0 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() { |