Skip to content

Commit

Permalink
fix(inputs): ensure the type has '' for mergeInputs
Browse files Browse the repository at this point in the history
  • Loading branch information
ctran authored and ctran committed Jun 17, 2024
1 parent 4c27e34 commit 06bc0fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libs/ngxtension/inject-inputs/src/lib/merge-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
*/
export function mergeInputs<TInputs extends object>(
defaultValue: TInputs = {} as TInputs,
) {
): (value: '' | Partial<TInputs>) => TInputs {
return (value: '' | Partial<TInputs>) => {
// NOTE: if the directive is used as `<div directive></div>` without binding syntax
// then the bound value is `''` in which case we'll return the `defaultValue` for the input
if (value === '') return defaultValue;
return { ...defaultValue, ...value } as TInputs;
return { ...defaultValue, ...value };
};
}

0 comments on commit 06bc0fd

Please sign in to comment.