Skip to content
module@warp-drive/experiments/storage @experimental

Interface ParamConfig ​

ts
interface ParamConfig {
  deserialize: (urlValue: string, instance: any) => unknown;
  getDefault?: (instance: any) => unknown;
  serialize: (value: unknown, instance: any) => string | null;
}

Defined in: warp-drive-packages/experiments/src/storage/query-params.ts:12

Configuration options for fields that are also query parameters

Properties ​

deserialize ​

ts
deserialize: (urlValue: string, instance: any) => unknown;

Defined in: warp-drive-packages/experiments/src/storage/query-params.ts:22

Convert a string value from the URL back into its original type

Parameters ​

urlValue ​

string

instance ​

any

Returns ​

unknown


getDefault? ​

ts
getDefault?: (instance: any) => unknown;

Defined in: warp-drive-packages/experiments/src/storage/query-params.ts:32

Get the default value for this param from the given instance.

If not present, the value passed to the field initializer will be used as the default.

This should return the value in the field's native type, not the serialized URL form.

Parameters ​

instance ​

any

Returns ​

unknown


serialize ​

ts
serialize: (value: unknown, instance: any) => string | null;

Defined in: warp-drive-packages/experiments/src/storage/query-params.ts:17

Convert a value into a string for storage in the URL. null indicates the value should be omitted from the URL.

Parameters ​

value ​

unknown

instance ​

any

Returns ​

string | null

Released under the MIT License.