urlpattern-polyfill icon indicating copy to clipboard operation
urlpattern-polyfill copied to clipboard

Improve type safety of URLPattern args

Open nickserv opened this issue 3 years ago • 1 comments

This makes the types closer to the behavior of the polyfill and the Chrome implementation by using a discriminated union to determine if the second arg is allowed, and then sharing the args between methods in a tuple type.

Note that this is a breaking change for TypeScript users, as I wanted to get rid of URLPatternInput to improve type safety. If possible, I'd recommend a major release for this.

nickserv avatar Sep 09 '22 21:09 nickserv

@SanderElias can you review this?

kenchris avatar Nov 15 '22 09:11 kenchris