Match-id-9952e9ebc64f02cfbab95841eee1b1788348e9f6

This commit is contained in:
* 2023-01-10 20:09:54 +08:00
parent 4712e8a621
commit 1c3c678883
3 changed files with 6 additions and 4 deletions

View File

@ -77,3 +77,5 @@ export type Source = {
fileName: string;
lineNumber: number;
};
export type Callback = () => void;

View File

@ -13,7 +13,7 @@
* See the Mulan PSL v2 for more details.
*/
import type { VNode } from './Types';
import type { VNode, Callback } from './Types';
import { FlagUtils, ShouldCapture } from './vnode/VNodeFlags';
export type Update = {
@ -22,8 +22,6 @@ export type Update = {
callback: Callback | null;
};
export type Callback = () => any;
export type Updates = Array<Update> | null;
export enum UpdateState {

View File

@ -13,6 +13,8 @@
* See the Mulan PSL v2 for more details.
*/
import {Callback} from '../Types';
/**
* Component的api setState和forceUpdate在实例生成阶段实现
*/
@ -29,7 +31,7 @@ class Component<P, S, C> {
this.context = context;
}
setState(state: S, callback?: any) {
setState(state: S, callback?: Callback) {
if (isDev) {
console.error('Cant not call `this.setState` in the constructor of class component, it will do nothing');
}