You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently using mapWith to call the same mapper for nested object. For the original call I am passing in some options which is needed in parent object but is not needed in the child object.
The behavior mapWith is showing is that it is passing in the same options to the nested object call.
PFB the sample mapper.
Should the options be passed onto nested mapper call?
If yes, then would the same options be passed for other mapper calls too?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am currently using mapWith to call the same mapper for nested object. For the original call I am passing in some options which is needed in parent object but is not needed in the child object.
The behavior mapWith is showing is that it is passing in the same options to the nested object call.
PFB the sample mapper.
Should the options be passed onto nested mapper call?
If yes, then would the same options be passed for other mapper calls too?
createMap(
mapper,
AssetTemplate,
CreatePhysicalAssetInput,
forMember(
(d) => d.code,
mapFrom((s) => s.code + generateUniqueCode()),
),
forMember(
(d) => d.madeFrom,
mapFrom((s) => s.id),
),
forMember(
(d) => d.manufacturer,
mapWithArguments(
(s, options: { assetCreateInput: CreatePhysicalAssetInput }) =>
options.assetCreateInput?.manufacturer ?? s.manufacturer?.id,
),
),
forMember(
(d) => d.children,
mapWith(CreatePhysicalAssetInput, AssetTemplate, (s) => s.children),
),
...mapToIgnoreFields<AssetTemplate, CreatePhysicalAssetInput>({
ignoreFields: ignoreExtraFields,
}),
);
Beta Was this translation helpful? Give feedback.
All reactions