In the docs for the bidsBackHandler, you get referred to the getBidResponses doc for the bids argument with which the bidsBackHandler is called.
In V10, the return value for getBidResponses has been changed to an array, while retaining the .bids property for backwards compatibility.
This is reflected in the types:
function getBidReponses(): ByAdUnit<WrapInBids<Bid>>
It isn't reflected in the docs yet, but I already opened a PR in the docs repo to correct this.
As such, I expect that the bidsBackHandler receives a bids argument of the same type: ByAdUnit<WrapInBids<Bid>>.
Looking at the types of the bidsBackHandler in the RequestBidsOptions type, that expectation is correct:
bidsBackHandler?: (bids?: RequestBidsResult['bids'], ...) => void;
and
type RequestBidsResult = {
bids?: ByAdUnit<WrapsInBids<Bid>>;
...
}
However, bids still seems to be a map where the ad unit is the key, and the value is an object with a bids property. The value isn't an array. So it is still the same return type as in V9, and doesn't match the typescript types.
The problem is in auction.ts#groupByPlacement:
function groupByPlacement(bidsByPlacement, bid) {
if (!bidsByPlacement[bid.adUnitCode]) { bidsByPlacement[bid.adUnitCode] = { bids: [] }; }
bidsByPlacement[bid.adUnitCode].bids.push(bid);
return bidsByPlacement;
}
This creates an object and not an arrray with the .bids property
In the docs for the
bidsBackHandler, you get referred to thegetBidResponsesdoc for thebidsargument with which thebidsBackHandleris called.In V10, the return value for
getBidResponseshas been changed to an array, while retaining the.bidsproperty for backwards compatibility.This is reflected in the types:
It isn't reflected in the docs yet, but I already opened a PR in the docs repo to correct this.
As such, I expect that the
bidsBackHandlerreceives abidsargument of the same type:ByAdUnit<WrapInBids<Bid>>.Looking at the types of the
bidsBackHandlerin theRequestBidsOptionstype, that expectation is correct:and
However,
bidsstill seems to be a map where the ad unit is the key, and the value is an object with abidsproperty. The value isn't an array. So it is still the same return type as in V9, and doesn't match the typescript types.The problem is in
auction.ts#groupByPlacement:This creates an object and not an arrray with the
.bidsproperty