Skip to content

Commit 81d58be

Browse files
authored
🤖 Merge PR DefinitelyTyped#72997 [node] v24.0 hotfix: URLPattern prototype by @Renegade334
1 parent 033273b commit 81d58be

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

‎types/node/test/url.ts‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,23 @@ import * as url from "node:url";
224224
}
225225

226226
{
227-
const urlPattern = new url.URLPattern("https://nodejs.org/docs/latest/api/*.html");
227+
const urlPattern = new url.URLPattern("https://nodejs.org/docs/latest/api/*.html", { ignoreCase: false });
228228
urlPattern.exec("https://nodejs.org/docs/latest/api/dns.html");
229229
urlPattern.test("https://nodejs.org/docs/latest/api/dns.html");
230230
}
231+
232+
{
233+
const init: url.URLPatternInit = {
234+
pathname: "../docs/latest/api/*.html",
235+
};
236+
237+
const urlPattern = new url.URLPattern(init);
238+
urlPattern.exec(init, "https://nodejs.org/about");
239+
urlPattern.test(init, "https://nodejs.org/about");
240+
}
241+
242+
{
243+
const urlPattern = new url.URLPattern({});
244+
urlPattern.exec();
245+
urlPattern.test();
246+
}

‎types/node/url.d.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,17 @@ declare module "url" {
791791
class URLPattern {
792792
constructor(input: string | URLPatternInit, baseURL: string, options?: URLPatternOptions);
793793
constructor(input?: string | URLPatternInit, options?: URLPatternOptions);
794-
exec(input: string | URLPatternInit, baseURL?: string): URLPatternResult | null;
795-
test(input: string | URLPatternInit, baseURL?: string): boolean;
794+
exec(input?: string | URLPatternInit, baseURL?: string): URLPatternResult | null;
795+
readonly hasRegExpGroups: boolean;
796+
readonly hash: string;
797+
readonly hostname: string;
798+
readonly password: string;
799+
readonly pathname: string;
800+
readonly port: string;
801+
readonly protocol: string;
802+
readonly search: string;
803+
test(input?: string | URLPatternInit, baseURL?: string): boolean;
804+
readonly username: string;
796805
}
797806
interface URLSearchParamsIterator<T> extends NodeJS.Iterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
798807
[Symbol.iterator](): URLSearchParamsIterator<T>;

0 commit comments

Comments
 (0)