fix(types): fix types for readonly ref

fix #4180
This commit is contained in:
Evan You 2021-07-23 15:24:58 -04:00
parent 231dafd55a
commit 2581cfb707
2 changed files with 15 additions and 14 deletions

View File

@ -19,11 +19,6 @@ export interface Ref<T = any> {
* @internal * @internal
*/ */
_shallow?: boolean _shallow?: boolean
/**
* Deps are maintained locally rather than in depsMap for performance reasons.
*/
dep?: Dep
} }
type RefBase<T> = { type RefBase<T> = {

View File

@ -1,4 +1,4 @@
import { readonly, describe, expectError } from './index' import { ref, readonly, describe, expectError, expectType, Ref } from './index'
describe('should support DeepReadonly', () => { describe('should support DeepReadonly', () => {
const r = readonly({ obj: { k: 'v' } }) const r = readonly({ obj: { k: 'v' } })
@ -7,3 +7,9 @@ describe('should support DeepReadonly', () => {
// @ts-expect-error // @ts-expect-error
expectError((r.obj.k = 'x')) expectError((r.obj.k = 'x'))
}) })
// #4180
describe('readonly ref', () => {
const r = readonly(ref({ count: 1 }))
expectType<Ref>(r)
})