Skip to content
module@warp-drive/core/request

Function withResponseType() ​

ts
function withResponseType<T>(obj): RequestInfo<T> & object;

Defined in: warp-drive-packages/core/src/request.ts:34

Brands the supplied object with the supplied response type.

ts
import type { ReactiveDataDocument } from '@warp-drive/core/reactive';
import { withResponseType } from '@warp-drive/core/request';
import type { User } from '#/data/user.ts'

const result = await store.request(
 withResponseType<ReactiveDataDocument<User>>({ url: '/users/1' })
);

result.content.data; // will have type User

Type Parameters ​

T ​

T

Parameters ​

obj ​

RequestInfo

Returns ​

Released under the MIT License.