Skip to content

Commit

Permalink
fix: runtime-web components 类型错误 (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
hwaphon authored Aug 18, 2023
1 parent a2dcf89 commit d2bbda3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/runtime-web/src/runtime/public/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ export class KBComponent extends React.PureComponent<any, IState> {
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
}
Expand Down
9 changes: 9 additions & 0 deletions packages/runtime-web/src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/// <reference types="mini-types" />
/// <reference types="@types/react" />

type PromiseOptions<O> = Omit<O, 'success' | 'fail' | 'complete'>

type IGetLocationFailErrorType = 11 | 12 | 13 | 14
Expand All @@ -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
Expand Down

0 comments on commit d2bbda3

Please sign in to comment.