diff --git a/source/redirect/exports.ts b/source/redirect/exports.ts index 6a71e66..221a387 100644 --- a/source/redirect/exports.ts +++ b/source/redirect/exports.ts @@ -8,7 +8,7 @@ export type Redirects = HostnameRedirect; export function parseRedirect

( parameters: P, ): Redirects | undefined { - if (parameters.type === 'hostname') { + if (parameters?.type === 'hostname') { return new HostnameRedirect(parameters); } } diff --git a/tests/redirect.test.ts b/tests/redirect.test.ts index 5b0a819..062b2fc 100644 --- a/tests/redirect.test.ts +++ b/tests/redirect.test.ts @@ -22,6 +22,7 @@ test('parseRedirect', (t) => { { test: 'Invalid parameters', } as unknown as Redirects['parameters'], + undefined as unknown as Redirects['parameters'], hostnameParameters, ];