Skip to content

Documentation / @ember-data/request / index / withResponseType

Function: withResponseType()

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

Defined in: warp-drive-packages/core/declarations/request.d.ts:25

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

RequestInfo<T> & object

Released under the MIT License.