diff --git a/source/redirect/base.ts b/source/redirect/base.ts
index 0046116..ec03ac3 100644
--- a/source/redirect/base.ts
+++ b/source/redirect/base.ts
@@ -4,12 +4,12 @@ export const redirectTypes = ['hostname', 'simple'] as const;
export type MatcherType = typeof matcherTypes[number];
export type RedirectType = typeof redirectTypes[number];
-export function narrowMatchType(type: string): type is MatcherType {
- return matcherTypes.includes(type as MatcherType);
+export function narrowMatchType(value: string): value is MatcherType {
+ return matcherTypes.includes(value as MatcherType);
}
-export function narrowRedirectType(type: string): type is RedirectType {
- return redirectTypes.includes(type as RedirectType);
+export function narrowRedirectType(value: string): value is RedirectType {
+ return redirectTypes.includes(value as RedirectType);
}
export type Matcher = {
@@ -18,7 +18,7 @@ export type Matcher = {
};
export type RedirectParameters = {
- type: RedirectType;
+ redirectType: RedirectType;
};
export abstract class Redirect
{
diff --git a/source/redirect/exports.ts b/source/redirect/exports.ts
index 092ddb9..57a7d8a 100644
--- a/source/redirect/exports.ts
+++ b/source/redirect/exports.ts
@@ -10,13 +10,13 @@ export type Redirects = HostnameRedirect | SimpleRedirect;
export function parseRedirect
(
parameters: P,
): Redirects | undefined {
- const type = parameters?.type;
+ const redirectType = parameters?.redirectType;
- if (type === 'hostname') {
+ if (redirectType === 'hostname') {
return new HostnameRedirect(parameters);
}
- if (type === 'simple') {
+ if (redirectType === 'simple') {
return new SimpleRedirect(parameters);
}
}
diff --git a/source/redirect/hostname.ts b/source/redirect/hostname.ts
index 6eaf570..809075d 100644
--- a/source/redirect/hostname.ts
+++ b/source/redirect/hostname.ts
@@ -2,7 +2,7 @@ import {Redirect} from './base.js';
export type HostnameParameters = {
hostname: string;
- type: 'hostname';
+ redirectType: 'hostname';
};
export class HostnameRedirect extends Redirect {
diff --git a/source/redirect/simple.ts b/source/redirect/simple.ts
index e739a1a..ffb76d6 100644
--- a/source/redirect/simple.ts
+++ b/source/redirect/simple.ts
@@ -2,7 +2,7 @@ import {Redirect} from './base.js';
export type SimpleParameters = {
target: string;
- type: 'simple';
+ redirectType: 'simple';
};
export class SimpleRedirect extends Redirect {
diff --git a/tests/redirect.test.ts b/tests/redirect.test.ts
index eeaa61b..4867b3e 100644
--- a/tests/redirect.test.ts
+++ b/tests/redirect.test.ts
@@ -19,14 +19,14 @@ const hostnameParameters: HostnameRedirect['parameters'] = {
hostname: 'example.org',
matcherType: 'hostname',
toMatch: 'example.com',
- type: 'hostname',
+ redirectType: 'hostname',
};
const simpleParameters: SimpleRedirect['parameters'] = {
matcherType: 'hostname',
target: 'https://example.org/simple',
toMatch: 'example.com',
- type: 'simple',
+ redirectType: 'simple',
};
test('parseRedirect', (t) => {
@@ -101,6 +101,6 @@ test('Redirect.isMatch', (t) => {
test('Narrow match & redirect types', (t) => {
t.false(narrowMatchType('invalid'));
t.false(narrowRedirectType('invalid'));
- t.true(matcherTypes.every((type) => narrowMatchType(type)));
- t.true(redirectTypes.every((type) => narrowRedirectType(type)));
+ t.true(matcherTypes.every((value) => narrowMatchType(value)));
+ t.true(redirectTypes.every((value) => narrowRedirectType(value)));
});
diff --git a/tests/snapshots/tests/redirect.test.ts.md b/tests/snapshots/tests/redirect.test.ts.md
index 80edd98..692af26 100644
--- a/tests/snapshots/tests/redirect.test.ts.md
+++ b/tests/snapshots/tests/redirect.test.ts.md
@@ -12,8 +12,8 @@ Generated by [AVA](https://avajs.dev).
parameters: {
hostname: 'example.org',
matcherType: 'hostname',
+ redirectType: 'hostname',
toMatch: 'example.com',
- type: 'hostname',
},
}
@@ -22,9 +22,9 @@ Generated by [AVA](https://avajs.dev).
SimpleRedirect {
parameters: {
matcherType: 'hostname',
+ redirectType: 'simple',
target: 'https://example.org/simple',
toMatch: 'example.com',
- type: 'simple',
},
}
diff --git a/tests/snapshots/tests/redirect.test.ts.snap b/tests/snapshots/tests/redirect.test.ts.snap
index 50f6b83..904e77a 100644
Binary files a/tests/snapshots/tests/redirect.test.ts.snap and b/tests/snapshots/tests/redirect.test.ts.snap differ