From 454b54add0cd61e03f7968cc5700d7b24b825b47 Mon Sep 17 00:00:00 2001 From: tada5hi Date: Thu, 27 Oct 2022 16:27:16 +0200 Subject: [PATCH] fix: only inherit default-path for defined options --- src/parse/module.ts | 8 +++++--- src/parse/type.ts | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/parse/module.ts b/src/parse/module.ts index 8d81fc49..8646aede 100644 --- a/src/parse/module.ts +++ b/src/parse/module.ts @@ -23,9 +23,11 @@ export function parseQuery( ) : ParseOutput { options ??= {}; - const mergeWithGlobalOptions = (data: T) : T => { - if (options.defaultPath) { - data.defaultPath = options.defaultPath; + const mergeWithGlobalOptions = (data?: T) : T => { + if (typeof data !== 'undefined') { + if (options.defaultPath) { + data.defaultPath = options.defaultPath; + } } return data; diff --git a/src/parse/type.ts b/src/parse/type.ts index 544fdf61..7c5010ac 100644 --- a/src/parse/type.ts +++ b/src/parse/type.ts @@ -13,7 +13,7 @@ import { ParseParameterOptions, ParseParameterOutput } from './parameter'; //------------------------------------------------ export type ParseInput = { - [K in `${Parameter}` | `${URLParameter}`]?: any + [K in `${Parameter}` | `${URLParameter}`]?: unknown }; //------------------------------------------------