JS Docs
This commit is contained in:
@@ -1,6 +1,23 @@
|
||||
import { DataSourceResponse, UmbPagedData } from '../index.js';
|
||||
import { Diff } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
/**
|
||||
* This function extends the data set of a paged DataSourceResponse.
|
||||
* Provide the desired type as a generic type parameter.
|
||||
* This will require the appendData argument to fill in the missing properties of the items.
|
||||
* @param response {DataSourceResponse<UmbPagedData<object>>}
|
||||
* @param appendData {object} Additional properties to append to the data set.
|
||||
* @returns {DataSourceResponse<UmbPagedData<object>>}
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* type originalResponseType = { foo: string };
|
||||
* type extendedResponseType = { foo: string, bar: string };
|
||||
*
|
||||
* const extendedResponse = extendDataSourcePagedResponseData<extendedResponseType>(originalResponse, { bar: 'some additional data' });
|
||||
*
|
||||
* extendedResponse.data.items[0].bar is now equal to 'some additional data'
|
||||
*/
|
||||
export function extendDataSourcePagedResponseData<
|
||||
ExtendedDataType extends IncomingDataType,
|
||||
IncomingDataType extends object = object,
|
||||
|
||||
@@ -1,6 +1,23 @@
|
||||
import { DataSourceResponse } from '../index.js';
|
||||
import { Diff } from '@umbraco-cms/backoffice/utils';
|
||||
|
||||
/**
|
||||
* This function extends the data set of a DataSourceResponse.
|
||||
* Provide the desired type as a generic type parameter.
|
||||
* This will require the appendData argument to fill in the missing properties of the data.
|
||||
* @param response {DataSourceResponse<object>}
|
||||
* @param appendData {object} Additional properties to append to the data.
|
||||
* @returns {DataSourceResponse<object>}
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* type originalResponseType = { foo: string };
|
||||
* type extendedResponseType = { foo: string, bar: string };
|
||||
*
|
||||
* const extendedResponse = extendDataSourceResponseData<extendedResponseType>(originalResponse, { bar: 'some additional data' });
|
||||
*
|
||||
* extendedResponse.data.bar is now equal to 'some additional data'
|
||||
*/
|
||||
export function extendDataSourceResponseData<
|
||||
ExtendedDataType extends IncomingDataType,
|
||||
IncomingDataType extends object = object,
|
||||
|
||||
Reference in New Issue
Block a user