feat(types/reactivity): use DeepReadonly type for readonly return type (#1462)

close #1452
This commit is contained in:
Pick
2020-07-15 21:27:21 +08:00
committed by GitHub
parent 246ec5c594
commit b772bba558
3 changed files with 33 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
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'))
})