From e9172db68b86fad2e0bb1de9e5d0dddbe3c2a25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Tue, 8 Nov 2022 10:03:49 +0800 Subject: [PATCH] fix(types): export `Raw` type (#6380) fix #7048 --- packages/reactivity/src/index.ts | 1 + packages/reactivity/src/reactive.ts | 6 +++--- packages/runtime-core/src/index.ts | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/reactivity/src/index.ts b/packages/reactivity/src/index.ts index a7a03b8c573..5c65cd52ae2 100644 --- a/packages/reactivity/src/index.ts +++ b/packages/reactivity/src/index.ts @@ -28,6 +28,7 @@ export { shallowReadonly, markRaw, toRaw, + Raw, ReactiveFlags, DeepReadonly, ShallowReactive, diff --git a/packages/reactivity/src/reactive.ts b/packages/reactivity/src/reactive.ts index 1a947499710..83e1c7abee1 100644 --- a/packages/reactivity/src/reactive.ts +++ b/packages/reactivity/src/reactive.ts @@ -241,9 +241,9 @@ export function toRaw(observed: T): T { return raw ? toRaw(raw) : observed } -export function markRaw( - value: T -): T & { [RawSymbol]?: true } { +export type Raw = T & { [RawSymbol]?: true } + +export function markRaw(value: T): Raw { def(value, ReactiveFlags.SKIP, true) return value } diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index 735bea7d1e4..2b9bde82c44 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -172,7 +172,8 @@ export { DebuggerEvent, DebuggerEventExtraInfo, TrackOpTypes, - TriggerOpTypes + TriggerOpTypes, + Raw } from '@vue/reactivity' export { WatchEffect,