Skip to content

Commit

Permalink
fix(query): better body definition regex (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Nov 14, 2023
1 parent 0ddd9e5 commit 1000e2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,11 @@ const generateQueryRequestFunction = (
isExactOptionalPropertyTypes,
});

let bodyDefinition = body.definition.replace('[]', '\\[\\]');
let propsImplementation =
mutator?.bodyTypeName && body.definition
? toObjectString(props, 'implementation').replace(
new RegExp(`(\\w*):\\s?${body.definition}`),
new RegExp(`(\\w*):\\s?${bodyDefinition}`),
`$1: ${mutator.bodyTypeName}<${body.definition}>`,
)
: toObjectString(props, 'implementation');
Expand Down

0 comments on commit 1000e2d

Please sign in to comment.