From 980cd03c97924530bb58444bd4bf1267d121c0ee Mon Sep 17 00:00:00 2001 From: Ako Tulu Date: Mon, 13 Jan 2025 06:18:21 +0200 Subject: [PATCH 1/2] fix(runtime-core): type ExposedKeys removed defined properties on component instace --- packages/runtime-core/src/componentPublicInstance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime-core/src/componentPublicInstance.ts b/packages/runtime-core/src/componentPublicInstance.ts index e9e7770ebd9..e7aa7adf0d3 100644 --- a/packages/runtime-core/src/componentPublicInstance.ts +++ b/packages/runtime-core/src/componentPublicInstance.ts @@ -285,7 +285,7 @@ export type CreateComponentPublicInstanceWithMixins< export type ExposedKeys< T, Exposed extends string & keyof T, -> = '' extends Exposed ? T : Pick +> = Exposed extends string ? T : Pick // public properties exposed on the proxy, which is used as the render context // in templates (as `this` in the render option) From 3fb85cf44321574b13ea696bbcb294583520e71c Mon Sep 17 00:00:00 2001 From: Ako Tulu Date: Wed, 22 Jan 2025 08:34:56 +0200 Subject: [PATCH 2/2] test(runtime-core): fixed expose typing test --- packages-private/dts-test/defineComponent.test-d.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages-private/dts-test/defineComponent.test-d.tsx b/packages-private/dts-test/defineComponent.test-d.tsx index fda3ca4856c..ffd968c4fa9 100644 --- a/packages-private/dts-test/defineComponent.test-d.tsx +++ b/packages-private/dts-test/defineComponent.test-d.tsx @@ -1620,7 +1620,7 @@ describe('expose typing', () => { some: String, }, data() { - return { a: 1, b: '2', c: 1 } + return { c: 1, d: '2', e: 1 } }, }) @@ -1630,11 +1630,14 @@ describe('expose typing', () => { // internal should still be exposed vm.$props - expectType(vm.a) - expectType(vm.b) + expectType(vm.c) + expectType(vm.d) + expectType(vm.e) // @ts-expect-error shouldn't be exposed - vm.c + vm.a + // @ts-expect-error shouldn't be exposed + vm.b }) import type {