From: 魏 <2553241022@qq.com> Date: Mon, 10 Jul 2023 10:00:32 +0000 (+0800) Subject: chore(types): remove unnecessary @ts-ignore or use @ts-expected-error (#7178) X-Git-Tag: v3.3.5~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4012438553700f96ef6fddb26bcab97998991d7;p=thirdparty%2Fvuejs%2Fcore.git chore(types): remove unnecessary @ts-ignore or use @ts-expected-error (#7178) --- diff --git a/packages/reactivity/__tests__/computed.spec.ts b/packages/reactivity/__tests__/computed.spec.ts index 055ad69cc7..c044b5feb3 100644 --- a/packages/reactivity/__tests__/computed.spec.ts +++ b/packages/reactivity/__tests__/computed.spec.ts @@ -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) diff --git a/packages/reactivity/__tests__/reactive.spec.ts b/packages/reactivity/__tests__/reactive.spec.ts index 3026d63ba1..e7fe18252a 100644 --- a/packages/reactivity/__tests__/reactive.spec.ts +++ b/packages/reactivity/__tests__/reactive.spec.ts @@ -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)