From d2bbda32ef02f85af0125fceb7dd2b19bc595860 Mon Sep 17 00:00:00 2001 From: Hwaphon Date: Fri, 18 Aug 2023 16:18:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20runtime-web=20components=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=94=99=E8=AF=AF=20(#100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/runtime-web/src/runtime/public/component.tsx | 2 +- packages/runtime-web/src/types/index.d.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/runtime-web/src/runtime/public/component.tsx b/packages/runtime-web/src/runtime/public/component.tsx index 6938d917..bbb9d38e 100644 --- a/packages/runtime-web/src/runtime/public/component.tsx +++ b/packages/runtime-web/src/runtime/public/component.tsx @@ -463,7 +463,7 @@ export class KBComponent extends React.PureComponent { const $slots = {} if (this.props.children) { if (this.props.children instanceof Array) { - this.props.children.forEach((i) => { + this.props.children.forEach((i: ReactNodeSlot) => { if (i.props && i.props._slot) { $slots[i.props._slot] = i } diff --git a/packages/runtime-web/src/types/index.d.ts b/packages/runtime-web/src/types/index.d.ts index 50751204..2bad3728 100644 --- a/packages/runtime-web/src/types/index.d.ts +++ b/packages/runtime-web/src/types/index.d.ts @@ -1,4 +1,6 @@ /// +/// + type PromiseOptions = Omit type IGetLocationFailErrorType = 11 | 12 | 13 | 14 @@ -7,6 +9,13 @@ interface PhoneOptions { [number: string]: string } +interface ReactNodeSlot extends ReactNode { + props?: { + _slot: string + [prop: string]: any + } +} + interface Window { my: any getApp: () => IApp