import { WritableComputedRef } from '@vue/reactivity' import { expectType, ref, Ref, ComputedRef } from './index' import 'vue/ref-macros' // wrapping refs // normal // computed // writable computed // destructure const { x, y, z } = $(useFoo()) expectType(x) expectType(y) expectType(z) // $ref expectType($ref(1)) expectType($ref(ref(1))) expectType<{ foo: number }>($ref({ foo: ref(1) })) // $shallowRef expectType($shallowRef(1)) expectType<{ foo: Ref }>($shallowRef({ foo: ref(1) })) // $computed expectType($computed(() => 1)) let b = $ref(1) expectType( $computed(() => b, { onTrack() {} }) ) // writable computed expectType( $computed({ get: () => 1, set: () => {} }) ) function useFoo() { return { x: ref(1), y: ref('hi'), z: 123 } } // $$ expectType>($$(x)) expectType>($$(y)) const c = $computed(() => 1) const cRef = $$(c) expectType>(cRef) const c2 = $computed({ get: () => 1, set: () => {} }) const c2Ref = $$(c2) expectType>(c2Ref) // $$ on object