Skip to content

Commit 2581cfb

Browse files
committed
fix(types): fix types for readonly ref
fix #4180
1 parent 231dafd commit 2581cfb

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

packages/reactivity/src/ref.ts

-5
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ export interface Ref<T = any> {
1919
* @internal
2020
*/
2121
_shallow?: boolean
22-
23-
/**
24-
* Deps are maintained locally rather than in depsMap for performance reasons.
25-
*/
26-
dep?: Dep
2722
}
2823

2924
type RefBase<T> = {

test-dts/reactivity.test-d.ts

+15-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
import { readonly, describe, expectError } from './index'
2-
3-
describe('should support DeepReadonly', () => {
4-
const r = readonly({ obj: { k: 'v' } })
5-
// @ts-expect-error
6-
expectError((r.obj = {}))
7-
// @ts-expect-error
8-
expectError((r.obj.k = 'x'))
9-
})
1+
import { ref, readonly, describe, expectError, expectType, Ref } from './index'
2+
3+
describe('should support DeepReadonly', () => {
4+
const r = readonly({ obj: { k: 'v' } })
5+
// @ts-expect-error
6+
expectError((r.obj = {}))
7+
// @ts-expect-error
8+
expectError((r.obj.k = 'x'))
9+
})
10+
11+
// #4180
12+
describe('readonly ref', () => {
13+
const r = readonly(ref({ count: 1 }))
14+
expectType<Ref>(r)
15+
})

0 commit comments

Comments
 (0)