Skip to content

Commit

Permalink
fix: only inherit default-path for defined options
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Oct 27, 2022
1 parent 5b775f9 commit 454b54a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/parse/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ export function parseQuery<T extends ObjectLiteral = ObjectLiteral>(
) : ParseOutput {
options ??= {};

const mergeWithGlobalOptions = <T extends {[key: string]: any} & {defaultPath?: string} >(data: T) : T => {
if (options.defaultPath) {
data.defaultPath = options.defaultPath;
const mergeWithGlobalOptions = <T extends {[key: string]: any} & {defaultPath?: string} >(data?: T) : T => {
if (typeof data !== 'undefined') {
if (options.defaultPath) {
data.defaultPath = options.defaultPath;
}
}

return data;
Expand Down
2 changes: 1 addition & 1 deletion src/parse/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { ParseParameterOptions, ParseParameterOutput } from './parameter';
//------------------------------------------------

export type ParseInput = {
[K in `${Parameter}` | `${URLParameter}`]?: any
[K in `${Parameter}` | `${URLParameter}`]?: unknown
};

//------------------------------------------------
Expand Down

0 comments on commit 454b54a

Please sign in to comment.