Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-web): 修复构建时可能遇到的类型错误问题 #100

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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