Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: always use whatwg-url #1

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { URL, URLSearchParams } from './whatwg-url';
import { URL, URLSearchParams } from 'whatwg-url';

const DUMMY_HOSTNAME = '__this_is_a_placeholder__';

Expand Down Expand Up @@ -48,10 +48,14 @@ const caseInsenstiveURLSearchParams = (Ctor: typeof URLSearchParams) =>

// Abstract middle class to appease TypeScript, see https://github.com/microsoft/TypeScript/pull/37894
abstract class URLWithoutHost extends URL {
abstract host: never;
abstract hostname: never;
abstract port: never;
abstract href: string;
abstract get host(): never;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the difference between the abstract property and the getter/setter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcasimir I don’t know why, but the TS definitions for whatwg-url use accessors, and the TS definitions for the global URL use properties. 🤷‍♀️

abstract set host(value: never);
abstract get hostname(): never;
abstract set hostname(value: never);
abstract get port(): never;
abstract set port(value: never);
abstract get href(): string;
abstract set href(value: string);
}

class MongoParseError extends Error {
Expand Down
33 changes: 0 additions & 33 deletions src/whatwg-url.ts

This file was deleted.