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

@@ -1,9 +1,15 @@
import { readonly, describe, expectError } 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'))
})
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)
})