scottrippey / next-router-mock

Mock implementation of the Next.js Router
MIT License
401 stars 38 forks source link

fix: update UrlObject type to match native url module #112

Closed harry-gocity closed 11 months ago

harry-gocity commented 11 months ago

This PR updates the library's own UrlObject to match the type defined in the native url module. UrlObject is defined in @types/node v16, v18 and latest as:

interface UrlObject {
    auth?: string | null | undefined;
    hash?: string | null | undefined;
    host?: string | null | undefined;
    hostname?: string | null | undefined;
    href?: string | null | undefined;
    pathname?: string | null | undefined;
    protocol?: string | null | undefined;
    search?: string | null | undefined;
    slashes?: boolean | null | undefined;
    port?: string | number | null | undefined;
    query?: string | null | ParsedUrlQueryInput | undefined;
}

This should fix type issues trying to use url UrlObject with next-router-mock:

image

Related: https://github.com/scottrippey/next-router-mock/pull/82

changeset-bot[bot] commented 11 months ago

🦋 Changeset detected

Latest commit: 4603169660e87f14b0b78930f067cede64e56259

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------- | ----- | | next-router-mock | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR