mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add checkPropTypes definition to @types/prop-types
I used the jsdoc as guide in https://github.com/facebook/prop-types/blob/master/checkPropTypes.js
This commit is contained in:
parent
27e6a748e9
commit
ee0fd76b1a
12
types/prop-types/index.d.ts
vendored
12
types/prop-types/index.d.ts
vendored
@ -28,3 +28,15 @@ export function oneOfType(types: Array<Validator<any>>): Requireable<any>;
|
||||
export function arrayOf(type: Validator<any>): Requireable<any>;
|
||||
export function objectOf(type: Validator<any>): Requireable<any>;
|
||||
export function shape(type: ValidationMap<any>): Requireable<any>;
|
||||
|
||||
/**
|
||||
* Assert that the values match with the type specs.
|
||||
* Error messages are memorized and will only be shown once.
|
||||
*
|
||||
* @param typeSpecs Map of name to a ReactPropType
|
||||
* @param values Runtime values that need to be type-checked
|
||||
* @param location e.g. "prop", "context", "child context"
|
||||
* @param componentName Name of the component for error messages.
|
||||
* @param getStack Returns the component stack.
|
||||
*/
|
||||
export function checkPropTypes(typeSpecs: any, values: any, location: string, componentName: string, getStack?: () => any): void;
|
||||
|
||||
@ -25,3 +25,5 @@ const propTypes: PropTypes.ValidationMap<Props> = {
|
||||
node: PropTypes.node.isRequired,
|
||||
element: PropTypes.element.isRequired
|
||||
};
|
||||
|
||||
PropTypes.checkPropTypes({xs: PropTypes.array}, {xs: []}, 'location', 'componentName');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user