]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(types): fix types for readonly ref
authorEvan You <yyx990803@gmail.com>
Fri, 23 Jul 2021 19:24:58 +0000 (15:24 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 23 Jul 2021 19:24:58 +0000 (15:24 -0400)
fix #4180

packages/reactivity/src/ref.ts
test-dts/reactivity.test-d.ts

index 010fb8d85bd236a2f984fec44d6e71f5bf7ec287..98cb3e2f37691f8b5d6d84904f47a72aed637645 100644 (file)
@@ -19,11 +19,6 @@ export interface Ref<T = any> {
    * @internal
    */
   _shallow?: boolean
-
-  /**
-   * Deps are maintained locally rather than in depsMap for performance reasons.
-   */
-  dep?: Dep
 }
 
 type RefBase<T> = {
index edccd4fa09986ba74ca29b2d13af440f45397d4d..3c35ea58a01636485696f45af7bba54c1e65812d 100644 (file)
@@ -1,9 +1,15 @@
-import { readonly, describe, expectError } from './index'\r
-\r
-describe('should support DeepReadonly', () => {\r
-  const r = readonly({ obj: { k: 'v' } })\r
-  // @ts-expect-error\r
-  expectError((r.obj = {}))\r
-  // @ts-expect-error\r
-  expectError((r.obj.k = 'x'))\r
-})\r
+import { ref, readonly, describe, expectError, expectType, Ref } from './index'
+
+describe('should support DeepReadonly', () => {
+  const r = readonly({ obj: { k: 'v' } })
+  // @ts-expect-error
+  expectError((r.obj = {}))
+  // @ts-expect-error
+  expectError((r.obj.k = 'x'))
+})
+
+// #4180
+describe('readonly ref', () => {
+  const r = readonly(ref({ count: 1 }))
+  expectType<Ref>(r)
+})