mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Adding PropTypes
This commit is contained in:
Vendored
+31
-5
@@ -31,14 +31,15 @@ declare module "react" {
|
||||
componentWillUnmount?(): void;
|
||||
}
|
||||
|
||||
interface FunctionMap {
|
||||
[key: string]: Function
|
||||
}
|
||||
|
||||
export interface Specification<P, S> extends Mixin<P, S> {
|
||||
displayName?: string;
|
||||
mixins?: Mixin<P, S>[];
|
||||
statics?: {
|
||||
[key: string]: Function
|
||||
};
|
||||
// TODO: Do the correct type definition
|
||||
propTypes?: Object;
|
||||
statics?: FunctionMap;
|
||||
propTypes?: FunctionMap;
|
||||
getDefaultProps?(): P;
|
||||
getInitialState?(): S;
|
||||
render(): Descriptor<any>;
|
||||
@@ -55,6 +56,31 @@ declare module "react" {
|
||||
replaceProps(nextProps: P, callback?: () => void): void;
|
||||
}
|
||||
|
||||
interface Constructable {
|
||||
new(): any;
|
||||
}
|
||||
|
||||
interface Requireable extends Function {
|
||||
isRequired: Function;
|
||||
}
|
||||
|
||||
export var PropsTypes: {
|
||||
any: Requireable;
|
||||
array: Requireable;
|
||||
bool: Requireable;
|
||||
func: Requireable;
|
||||
number: Requireable;
|
||||
object: Requireable;
|
||||
string: Requireable;
|
||||
renderable: Requireable;
|
||||
component: Requireable;
|
||||
instanceOf: (clazz: Constructable) => Requireable;
|
||||
oneOf: (types: any[]) => Requireable;
|
||||
oneOfType: (types: Function[]) => Requireable;
|
||||
arrayOf: (type: Function) => Requireable;
|
||||
shape: (type: FunctionMap) => Requireable;
|
||||
};
|
||||
|
||||
export var Children: {
|
||||
map(children: any[], fn: (child: any) => any): any[];
|
||||
forEach(children: any[], fn: (child: any) => any): void;
|
||||
|
||||
Reference in New Issue
Block a user