componentCustomProperties.test-d.ts 440 B

1234567891011121314151617181920
  1. import { expectError } from 'tsd'
  2. import { defineComponent } from './index'
  3. declare module '@vue/runtime-core' {
  4. interface ComponentCustomProperties {
  5. state: 'stopped' | 'running'
  6. }
  7. }
  8. export const Custom = defineComponent({
  9. data: () => ({ counter: 0 }),
  10. methods: {
  11. aMethod() {
  12. expectError(this.notExisting)
  13. this.counter++
  14. this.state = 'running'
  15. expectError((this.state = 'not valid'))
  16. }
  17. }
  18. })