feat(types): feat(types): add ComponentCustomProperties interface (#982)

This commit is contained in:
Evan You
2020-04-17 09:12:50 -04:00
parent 4cf5e07608
commit be21cfb1db
5 changed files with 59 additions and 7 deletions

View File

@@ -0,0 +1,20 @@
import { expectError } from 'tsd'
import { defineComponent } from './index'
declare module '@vue/runtime-core' {
interface ComponentCustomProperties {
state: 'stopped' | 'running'
}
}
export const Custom = defineComponent({
data: () => ({ counter: 0 }),
methods: {
aMethod() {
expectError(this.notExisting)
this.counter++
this.state = 'running'
expectError((this.state = 'not valid'))
}
}
})