Skip to content

Commit

Permalink
test(types): test computed get/set type inference (#1709)
Browse files Browse the repository at this point in the history
  • Loading branch information
pikax authored Jul 28, 2020
1 parent 06cad62 commit 421a70d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test-dts/defineComponent.test-d.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,19 @@ describe('type inference w/ options API', () => {
d(): number {
expectType<number>(this.b)
return this.b + 1
},
e: {
get(): number {
expectType<number>(this.b)
expectType<number>(this.d)

return this.b + this.d
},
set(v: number) {
expectType<number>(this.b)
expectType<number>(this.d)
expectType<number>(v)
}
}
},
watch: {
Expand All @@ -286,6 +299,8 @@ describe('type inference w/ options API', () => {
expectType<number>(this.c)
// computed
expectType<number>(this.d)
// computed get/set
expectType<number>(this.e)
},
methods: {
doSomething() {
Expand All @@ -297,6 +312,8 @@ describe('type inference w/ options API', () => {
expectType<number>(this.c)
// computed
expectType<number>(this.d)
// computed get/set
expectType<number>(this.e)
},
returnSomething() {
return this.a
Expand All @@ -311,6 +328,8 @@ describe('type inference w/ options API', () => {
expectType<number>(this.c)
// computed
expectType<number>(this.d)
// computed get/set
expectType<number>(this.e)
// method
expectType<() => number | undefined>(this.returnSomething)
}
Expand Down

0 comments on commit 421a70d

Please sign in to comment.