From: Carlos Rodrigues Date: Tue, 28 Jul 2020 19:40:23 +0000 (+0100) Subject: test(types): test computed get/set type inference (#1709) X-Git-Tag: v3.0.0-rc.5~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=421a70de5e2a138bec3fbc228dad89ef934e1bb5;p=thirdparty%2Fvuejs%2Fcore.git test(types): test computed get/set type inference (#1709) --- diff --git a/test-dts/defineComponent.test-d.tsx b/test-dts/defineComponent.test-d.tsx index 29194ca391..dcbad6a0fa 100644 --- a/test-dts/defineComponent.test-d.tsx +++ b/test-dts/defineComponent.test-d.tsx @@ -269,6 +269,19 @@ describe('type inference w/ options API', () => { d(): number { expectType(this.b) return this.b + 1 + }, + e: { + get(): number { + expectType(this.b) + expectType(this.d) + + return this.b + this.d + }, + set(v: number) { + expectType(this.b) + expectType(this.d) + expectType(v) + } } }, watch: { @@ -286,6 +299,8 @@ describe('type inference w/ options API', () => { expectType(this.c) // computed expectType(this.d) + // computed get/set + expectType(this.e) }, methods: { doSomething() { @@ -297,6 +312,8 @@ describe('type inference w/ options API', () => { expectType(this.c) // computed expectType(this.d) + // computed get/set + expectType(this.e) }, returnSomething() { return this.a @@ -311,6 +328,8 @@ describe('type inference w/ options API', () => { expectType(this.c) // computed expectType(this.d) + // computed get/set + expectType(this.e) // method expectType<() => number | undefined>(this.returnSomething) }