21 lines
558 B
TypeScript
21 lines
558 B
TypeScript
import {
|
|
computed as _computed,
|
|
ComputedRef,
|
|
WritableComputedOptions,
|
|
WritableComputedRef,
|
|
ComputedGetter
|
|
} from '@vue/reactivity'
|
|
import { recordInstanceBoundEffect } from './component'
|
|
|
|
export function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>
|
|
export function computed<T>(
|
|
options: WritableComputedOptions<T>
|
|
): WritableComputedRef<T>
|
|
export function computed<T>(
|
|
getterOrOptions: ComputedGetter<T> | WritableComputedOptions<T>
|
|
) {
|
|
const c = _computed(getterOrOptions as any)
|
|
recordInstanceBoundEffect(c.effect)
|
|
return c
|
|
}
|