@instructure/ui-react-utils
Version:
A React utility library made by Instructure Inc.
37 lines • 1.31 kB
TypeScript
import PropTypes from 'prop-types';
export interface DeprecatedDecorator {
(version: string, oldProps?: Record<string, any> | null, message?: string): (ComposedComponent: any) => any;
deprecatePropValues: (...args: any[]) => PropTypes.Validator<unknown>;
warnDeprecatedProps: (...args: any[]) => void;
warnDeprecatedComponent: (...args: any[]) => void;
changedPackageWarning: (...args: any[]) => string;
}
/**
* ---
* category: utilities/react
* ---
* Deprecate React component props. Warnings will display in the console when deprecated
* props are used. Include the version number when the deprecated component will be removed.
*
* ```js-code
* class Example extends Component {
* static propTypes = {
* currentProp: PropTypes.func
* }
* }
* export default deprecated('7.0.0', {
* deprecatedProp: 'currentProp',
* nowNonExistentProp: true
* })(Example)
* ```
*
* @param {string} version
* @param {object} oldProps (if this argument is null or undefined, the entire component is deprecated)
* @param {string} message
* @return {function} React component with deprecated props behavior
* @module deprecated
*/
declare const deprecated: DeprecatedDecorator;
export default deprecated;
export { deprecated };
//# sourceMappingURL=deprecated.d.ts.map