chore(types): delete @ts-ignore or use @ts-expected-error instead (#3669)

Co-authored-by: heyunfei.i <heyunfei.i@bytedance.com>
This commit is contained in:
HeYunfei
2022-05-12 08:40:59 +08:00
committed by GitHub
parent cd395559ce
commit b5b103a736
8 changed files with 29 additions and 34 deletions

View File

@@ -334,7 +334,10 @@ describe('api: lifecycle hooks', () => {
const onTrigger = jest.fn((e: DebuggerEvent) => {
events.push(e)
})
const obj = reactive({ foo: 1, bar: 2 })
const obj = reactive<{
foo: number
bar?: number
}>({ foo: 1, bar: 2 })
const Comp = {
setup() {
@@ -356,7 +359,6 @@ describe('api: lifecycle hooks', () => {
newValue: 2
})
// @ts-ignore
delete obj.bar
await nextTick()
expect(onTrigger).toHaveBeenCalledTimes(2)

View File

@@ -1411,7 +1411,7 @@ describe('api: options', () => {
}
const root = nodeOps.createElement('div')
// @ts-ignore
// @ts-expect-error
render(h(Comp), root)
expect('Invalid watch option: "foo"').toHaveBeenWarned()

View File

@@ -214,7 +214,7 @@ describe('api: watch', () => {
})
it('warn invalid watch source', () => {
// @ts-ignore
// @ts-expect-error
watch(1, () => {})
expect(`Invalid watch source`).toHaveBeenWarned()
})
@@ -748,7 +748,7 @@ describe('api: watch', () => {
() => {
dummy = count.value
},
// @ts-ignore
// @ts-expect-error
{ immediate: false }
)
expect(dummy).toBe(0)
@@ -767,7 +767,7 @@ describe('api: watch', () => {
spy()
return arr
},
// @ts-ignore
// @ts-expect-error
{ deep: true }
)
expect(spy).toHaveBeenCalledTimes(1)
@@ -818,7 +818,7 @@ describe('api: watch', () => {
const onTrigger = jest.fn((e: DebuggerEvent) => {
events.push(e)
})
const obj = reactive({ foo: 1 })
const obj = reactive<{ foo?: number }>({ foo: 1 })
watchEffect(
() => {
dummy = obj.foo
@@ -828,7 +828,7 @@ describe('api: watch', () => {
await nextTick()
expect(dummy).toBe(1)
obj.foo++
obj.foo!++
await nextTick()
expect(dummy).toBe(2)
expect(onTrigger).toHaveBeenCalledTimes(1)
@@ -839,7 +839,6 @@ describe('api: watch', () => {
newValue: 2
})
// @ts-ignore
delete obj.foo
await nextTick()
expect(dummy).toBeUndefined()

View File

@@ -153,7 +153,7 @@ describe('component: emit', () => {
emits: ['foo'],
render() {},
created() {
// @ts-ignore
// @ts-expect-error
this.$emit('bar')
}
})
@@ -170,7 +170,7 @@ describe('component: emit', () => {
},
render() {},
created() {
// @ts-ignore
// @ts-expect-error
this.$emit('bar')
}
})
@@ -186,7 +186,7 @@ describe('component: emit', () => {
emits: [],
render() {},
created() {
// @ts-ignore
// @ts-expect-error
this.$emit('foo')
}
})