2020-06-09 22:17:42 +08:00
|
|
|
import { defineComponent, expectError, expectType } from './index'
|
2020-04-17 21:12:50 +08:00
|
|
|
|
|
|
|
declare module '@vue/runtime-core' {
|
2020-04-17 21:41:36 +08:00
|
|
|
interface ComponentCustomOptions {
|
|
|
|
test?(n: number): void
|
|
|
|
}
|
|
|
|
|
2020-04-17 21:12:50 +08:00
|
|
|
interface ComponentCustomProperties {
|
|
|
|
state: 'stopped' | 'running'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export const Custom = defineComponent({
|
|
|
|
data: () => ({ counter: 0 }),
|
2020-04-17 21:41:36 +08:00
|
|
|
|
|
|
|
test(n) {
|
|
|
|
expectType<number>(n)
|
|
|
|
},
|
|
|
|
|
2020-04-17 21:12:50 +08:00
|
|
|
methods: {
|
|
|
|
aMethod() {
|
2020-06-09 22:17:42 +08:00
|
|
|
// @ts-expect-error
|
2020-04-17 21:12:50 +08:00
|
|
|
expectError(this.notExisting)
|
|
|
|
this.counter++
|
|
|
|
this.state = 'running'
|
2020-06-09 22:17:42 +08:00
|
|
|
// @ts-expect-error
|
2020-04-17 21:12:50 +08:00
|
|
|
expectError((this.state = 'not valid'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|