]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
chore(types): remove unnecessary @ts-ignore or use @ts-expected-error (#7178)
author <2553241022@qq.com>
Mon, 10 Jul 2023 10:00:32 +0000 (18:00 +0800)
committerGitHub <noreply@github.com>
Mon, 10 Jul 2023 10:00:32 +0000 (18:00 +0800)
packages/reactivity/__tests__/computed.spec.ts
packages/reactivity/__tests__/reactive.spec.ts

index 055ad69cc7df5a48e1045531ea195961468174c2..c044b5feb35f5f7ef016a8c640bbce855194ea9b 100644 (file)
@@ -259,13 +259,13 @@ describe('reactivity/computed', () => {
     const onTrigger = vi.fn((e: DebuggerEvent) => {
       events.push(e)
     })
-    const obj = reactive({ foo: 1 })
+    const obj = reactive<{ foo?: number }>({ foo: 1 })
     const c = computed(() => obj.foo, { onTrigger })
 
     // computed won't trigger compute until accessed
     c.value
 
-    obj.foo++
+    obj.foo!++
     expect(c.value).toBe(2)
     expect(onTrigger).toHaveBeenCalledTimes(1)
     expect(events[0]).toEqual({
@@ -277,7 +277,6 @@ describe('reactivity/computed', () => {
       newValue: 2
     })
 
-    // @ts-ignore
     delete obj.foo
     expect(c.value).toBeUndefined()
     expect(onTrigger).toHaveBeenCalledTimes(2)
index 3026d63ba1c33b38c9fcb471391ff88d8aafe220..e7fe18252ab89eb2712b54b0477e9cef613bddae 100644 (file)
@@ -23,7 +23,7 @@ describe('reactivity/reactive', () => {
     const reactiveObj = reactive(obj)
     expect(isReactive(reactiveObj)).toBe(true)
     // read prop of reactiveObject will cause reactiveObj[prop] to be reactive
-    // @ts-ignore
+    // @ts-expect-error
     const prototype = reactiveObj['__proto__']
     const otherObj = { data: ['a'] }
     expect(isReactive(otherObj)).toBe(false)
@@ -204,7 +204,7 @@ describe('reactivity/reactive', () => {
     const dummy = computed(() => observed.a)
     expect(dummy.value).toBe(0)
 
-    // @ts-ignore
+    // @ts-expect-error
     observed.a = bar
     expect(dummy.value).toBe(1)