aboutsummaryrefslogtreecommitdiff
path: root/src/fields/URLField.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/fields/URLField.ts')
-rw-r--r--src/fields/URLField.ts18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/fields/URLField.ts b/src/fields/URLField.ts
index c6c51957d..3a83e7ca0 100644
--- a/src/fields/URLField.ts
+++ b/src/fields/URLField.ts
@@ -16,16 +16,18 @@ export abstract class URLField extends ObjectField {
@serializable(url())
readonly url: URL;
- constructor(url: string);
- constructor(url: URL);
- constructor(url: URL | string) {
+ constructor(urlVal: string);
+ // eslint-disable-next-line @typescript-eslint/no-shadow
+ constructor(urlVal: URL);
+ // eslint-disable-next-line @typescript-eslint/no-shadow
+ constructor(urlVal: URL | string) {
super();
this.url =
- typeof url !== 'string'
- ? url // it's an URL
- : url.startsWith('http')
- ? new URL(url)
- : new URL(url, window.location.origin);
+ typeof urlVal !== 'string'
+ ? urlVal // it's an URL
+ : urlVal.startsWith('http')
+ ? new URL(urlVal)
+ : new URL(urlVal, window.location.origin);
}
[ToScriptString]() {