1
0
mirror of https://github.com/flarum/core.git synced 2025-07-30 21:20:24 +02:00

fix: incorrect return type on pushPayload (#3226)

This commit is contained in:
David Wheatley
2021-12-26 07:25:16 +01:00
committed by GitHub
parent 46d90487e8
commit 3dcf7bcd67

View File

@@ -94,7 +94,7 @@ export default class Store {
* within the 'data' key of the payload.
*/
pushPayload<M extends Model>(payload: ApiPayloadSingle): ApiResponseSingle<M>;
pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponseSingle<Ms[number]>;
pushPayload<Ms extends Model[]>(payload: ApiPayloadPlural): ApiResponsePlural<Ms[number]>;
pushPayload<M extends Model | Model[]>(payload: ApiPayload): ApiResponse<FlatArray<M, 1>> {
if (payload.included) payload.included.map(this.pushObject.bind(this));