diff --git a/packages/runtime-core/src/helpers/refMacros.ts b/packages/runtime-core/src/helpers/refMacros.ts new file mode 100644 index 000000000..4c62441d2 --- /dev/null +++ b/packages/runtime-core/src/helpers/refMacros.ts @@ -0,0 +1,21 @@ +import { Ref, UnwrapRef, ShallowUnwrapRef, ComputedRef } from '@vue/reactivity' + +export function $ref(arg: T | Ref): UnwrapRef +export function $ref() {} + +declare const ComputedRefMarker: unique symbol +type ComputedRefValue = T & { [ComputedRefMarker]?: any } + +export function $computed(getter: () => T): ComputedRefValue +export function $computed() {} + +export function $fromRefs(source: T): ShallowUnwrapRef +export function $fromRefs() { + return null as any +} + +export function $raw(value: ComputedRefValue): ComputedRef +export function $raw(value: T): Ref +export function $raw() { + return null as any +} diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index 3249f3a44..79784acc1 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -53,20 +53,19 @@ export { provide, inject } from './apiInject' export { nextTick } from './scheduler' export { defineComponent } from './apiDefineComponent' export { defineAsyncComponent } from './apiAsyncComponent' +export { useAttrs, useSlots } from './apiSetupHelpers' //