From 6ed207a76f67793d114ef0081e80de469662c0a1 Mon Sep 17 00:00:00 2001 From: fxy060608 <153647646@qq.com> Date: Fri, 9 Aug 2024 14:01:30 +0800 Subject: [PATCH] =?UTF-8?q?wip(types):=20=E8=B0=83=E6=95=B4=20uesModel;=20?= =?UTF-8?q?=E8=A1=A5=E5=85=85=20ComponentInjectOption=20=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=8E=A8=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/dts-test/setupHelpers.test-d.ts | 3 ++- packages/runtime-core/src/apiDefineComponent.ts | 6 ++++-- packages/runtime-core/src/index.ts | 9 ++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/dts-test/setupHelpers.test-d.ts b/packages/dts-test/setupHelpers.test-d.ts index c749e80a5c7..d3bac2221fa 100644 --- a/packages/dts-test/setupHelpers.test-d.ts +++ b/packages/dts-test/setupHelpers.test-d.ts @@ -358,7 +358,8 @@ describe('useModel', () => { const r = useModel(props, 'foo') expectType>(r) - // @ts-expect-error + // fixed by xxxxxx + //// @ts-expect-error useModel(props, 'bar') }, }) diff --git a/packages/runtime-core/src/apiDefineComponent.ts b/packages/runtime-core/src/apiDefineComponent.ts index 8c0492e1cef..13608f00fad 100644 --- a/packages/runtime-core/src/apiDefineComponent.ts +++ b/packages/runtime-core/src/apiDefineComponent.ts @@ -55,6 +55,7 @@ export type DefineComponent< Props = ResolveProps, Defaults = ExtractDefaultPropTypes, S extends SlotsType = {}, + I extends ComponentInjectOptions = {}, // fixed by xxxxxx > = ComponentPublicInstanceConstructor< CreateComponentPublicInstance< Props, @@ -68,7 +69,7 @@ export type DefineComponent< PP & Props, Defaults, true, - {}, + I, S > > & @@ -197,7 +198,8 @@ export function defineComponent< PublicProps, ResolveProps, ExtractDefaultPropTypes, - S + S, + I // fixed by xxxxxx > // overload 3: object format with array props declaration diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index 4fe0e388ff4..3a0b702fcd8 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -61,7 +61,7 @@ export { nextTick } from './scheduler' export { defineComponent } from './apiDefineComponent' export { defineAsyncComponent } from './apiAsyncComponent' export { useAttrs, useSlots } from './apiSetupHelpers' -export { useModel } from './helpers/useModel' +// export { useModel } from './helpers/useModel' // fixed by xxxxxx //