Selaa lähdekoodia

fix(types): export `Raw` type (#6380)

fix #7048
三咲智子 Kevin Deng 3 vuotta sitten
vanhempi
commit
e9172db68b

+ 1 - 0
packages/reactivity/src/index.ts

@@ -28,6 +28,7 @@ export {
   shallowReadonly,
   markRaw,
   toRaw,
+  Raw,
   ReactiveFlags,
   DeepReadonly,
   ShallowReactive,

+ 3 - 3
packages/reactivity/src/reactive.ts

@@ -241,9 +241,9 @@ export function toRaw<T>(observed: T): T {
   return raw ? toRaw(raw) : observed
 }
 
-export function markRaw<T extends object>(
-  value: T
-): T & { [RawSymbol]?: true } {
+export type Raw<T> = T & { [RawSymbol]?: true }
+
+export function markRaw<T extends object>(value: T): Raw<T> {
   def(value, ReactiveFlags.SKIP, true)
   return value
 }

+ 2 - 1
packages/runtime-core/src/index.ts

@@ -172,7 +172,8 @@ export {
   DebuggerEvent,
   DebuggerEventExtraInfo,
   TrackOpTypes,
-  TriggerOpTypes
+  TriggerOpTypes,
+  Raw
 } from '@vue/reactivity'
 export {
   WatchEffect,