2020-04-17 21:41:36 +08:00
|
|
|
import { expectError, expectType } from 'tsd'
|
2020-04-17 21:12:50 +08:00
|
|
|
import { defineComponent } from './index'
|
|
|
|
|
|
|
|
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() {
|
|
|
|
expectError(this.notExisting)
|
|
|
|
this.counter++
|
|
|
|
this.state = 'running'
|
|
|
|
expectError((this.state = 'not valid'))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|