From deab409c1116d2e810cc018797b6c38061701f25 Mon Sep 17 00:00:00 2001 From: missanni Date: Tue, 20 Aug 2024 14:44:46 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BD=93SubComponents=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E6=9C=89=E5=90=8E=E7=BC=80=E6=97=B6,=E9=98=BB=E6=AD=A2?= =?UTF-8?q?=E7=A9=BF=E9=80=8F(=5Fcatch)=E4=BA=8B=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E8=A2=AB=E8=BF=94=E5=9B=9E=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 导出事件相关类型 --- .../SubReturnType/test/normal.test.ts | 44 +++++++++++++++++++ src/api/SubComponent/index.ts | 2 +- src/index.ts | 10 +++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/api/SubComponent/SubReturnType/test/normal.test.ts b/src/api/SubComponent/SubReturnType/test/normal.test.ts index dd1ce9f..33b3210 100644 --- a/src/api/SubComponent/SubReturnType/test/normal.test.ts +++ b/src/api/SubComponent/SubReturnType/test/normal.test.ts @@ -37,3 +37,47 @@ type SubDocExpect = { }; Checking(); +// 去除已经声明的穿透事件 +const removeCatchedEvents = SubComponent<{}, CompDoc>()({ + data: { + aaa_str: "string", + }, + events: { + aaa_bubblesCaptrueComposed_catch(e) { + console.log(e); + }, + aaa_bubblesComposed_catch(e) { + console.log(e); + }, + aaa_captrueComposed_catch(e) { + console.log(e); + }, + }, +}); +void removeCatchedEvents; +// 返回穿透的自定义事件,并去除了前缀 +type RemoveSubDoc = never; + +Checking(); +// 去除有后缀时,已经声明的穿透事件 +const removeCatchedEventsOfSuffix = SubComponent<{}, CompDoc, "aa">()({ + data: { + aaaAa_str: "string", + }, + events: { + aaaAa_bubblesCaptrueComposed_catch(e) { + console.log(e); + }, + aaaAa_bubblesComposed_catch(e) { + console.log(e); + }, + aaaAa_captrueComposed_catch(e) { + console.log(e); + }, + }, +}); +void removeCatchedEventsOfSuffix; +// 返回穿透的自定义事件,并去除了前缀 +type RemoveCatchedEventsOfSuffix = never; + +Checking(); diff --git a/src/api/SubComponent/index.ts b/src/api/SubComponent/index.ts index 3d89f7a..b944019 100644 --- a/src/api/SubComponent/index.ts +++ b/src/api/SubComponent/index.ts @@ -231,7 +231,7 @@ type SubComponentConstructor< SubEventsDoc, SubMethodsDoc >, -) => CreateSubComponentDoc, SubEventsDoc, MissingRequiredField>; +) => CreateSubComponentDoc, SubEventsDoc, MissingRequiredField>; /** * 子组件构建函数 diff --git a/src/index.ts b/src/index.ts index dea30d5..61f4536 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,6 +7,16 @@ import type { CreateComponentType } from "./types/CreateComponentType"; import type { DetailedType } from "./types/DetailedType"; import type { ExtendComponentType } from "./types/ExtendComponentType"; import type { ParamsEqual } from "./types/TwoParamsEqual"; +export type { + Bubbles, + BubblesCapture, + BubblesCaptureComposed, + BubblesComposed, + Capture, + CaptureComposed, + Composed, + CustomEventsTags, +} from "./api/RootComponent/CustomEvents/CustomEventsTag"; export type { Vant, Wm } from "./thirdLib"; export type {