Skip to content

Commit b401243

Browse files
authored
chore(types): remove unnecessary @ts-ignore or use @ts-expected-error (#7178)
1 parent 364dc53 commit b401243

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/reactivity/__tests__/computed.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ describe('reactivity/computed', () => {
259259
const onTrigger = vi.fn((e: DebuggerEvent) => {
260260
events.push(e)
261261
})
262-
const obj = reactive({ foo: 1 })
262+
const obj = reactive<{ foo?: number }>({ foo: 1 })
263263
const c = computed(() => obj.foo, { onTrigger })
264264

265265
// computed won't trigger compute until accessed
266266
c.value
267267

268-
obj.foo++
268+
obj.foo!++
269269
expect(c.value).toBe(2)
270270
expect(onTrigger).toHaveBeenCalledTimes(1)
271271
expect(events[0]).toEqual({
@@ -277,7 +277,6 @@ describe('reactivity/computed', () => {
277277
newValue: 2
278278
})
279279

280-
// @ts-ignore
281280
delete obj.foo
282281
expect(c.value).toBeUndefined()
283282
expect(onTrigger).toHaveBeenCalledTimes(2)

packages/reactivity/__tests__/reactive.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('reactivity/reactive', () => {
2323
const reactiveObj = reactive(obj)
2424
expect(isReactive(reactiveObj)).toBe(true)
2525
// read prop of reactiveObject will cause reactiveObj[prop] to be reactive
26-
// @ts-ignore
26+
// @ts-expect-error
2727
const prototype = reactiveObj['__proto__']
2828
const otherObj = { data: ['a'] }
2929
expect(isReactive(otherObj)).toBe(false)
@@ -204,7 +204,7 @@ describe('reactivity/reactive', () => {
204204
const dummy = computed(() => observed.a)
205205
expect(dummy.value).toBe(0)
206206

207-
// @ts-ignore
207+
// @ts-expect-error
208208
observed.a = bar
209209
expect(dummy.value).toBe(1)
210210

0 commit comments

Comments
 (0)