@excentone/spfx-react
Version:
Contains custom ReactJs components and hooks intended to use when developing SharePoint Framework (SPFx) Web components.
22 lines (21 loc) • 728 B
TypeScript
/**
* Represents a query object.
*/
export declare type QueryObject = Record<string, any>;
/**
* A delegate for converting the query parameter value to the the target type specified by {@link TParam}.
*/
export declare type QueryParamConverter<TParam> = (paramValue: string) => TParam;
/**
* Options available for `useQueryParams` custom hook.
*/
export interface IQueryParamsHookOptions<TParams extends QueryObject> {
/**
* The url that has the query string to be parsed.
*/
url?: URL | string;
/**
* An object containing the delegates to convert each query string values to another type.
*/
conversions?: Partial<Record<keyof TParams, QueryParamConverter<TParams[keyof TParams]>>>;
}