vue-lynx / toRaw

Function: toRaw()

function toRaw<T>(observed): T

Returns the raw, original object of a Vue-created proxy.

toRaw() can return the original object from proxies created by reactive, readonly, shallowReactive or shallowReadonly.

This is an escape hatch that can be used to temporarily read without incurring proxy access / tracking overhead or write without triggering changes. It is not recommended to hold a persistent reference to the original object. Use with caution.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
observedTThe object for which the "raw" value is requested.

Returns

T

Example

const foo = {}
const reactiveFoo = reactive(foo)

console.log(toRaw(reactiveFoo) === foo) // true

See

https://vuejs.org/api/reactivity-advanced.html#toraw

Defined in

node_modules/.pnpm/@vue+reactivity@3.5.30/node_modules/@vue/reactivity/dist/reactivity.d.ts:209