DefinitelyTyped/types/react-is-deprecated/react-is-deprecated-tests.ts
John Gozde bbf3e9cb0b [react]: Remove deprecated+removed APIs (#20409)
* create-react-class: add definitions

* react-dom-factories: add definitions

* create-react-class: add tests, fix errors

* react-dom-factories: add tests, fix lint

* react: remove previously deprecated APIs

* Remove deprecated usages in other definitions

* redux-form: disable strictFunctionTypes

Changes to react typings revealed errors in redux-form that are present
in 'master'. This needs to be handled separately.

* Update create-react-class, react-dom-factories author

* Avoid importing create-react-class where possible

* Move top-level createReactClass tests to create-react-class
2017-10-16 15:22:04 -07:00

15 lines
479 B
TypeScript

import * as PropTypes from 'prop-types';
import { deprecate, addIsDeprecated } from 'react-is-deprecated';
// test: one-off deprecation
deprecate(PropTypes.string, 'message');
// test: one-off deprecated with isRequired
deprecate(PropTypes.string.isRequired, 'message');
// test: isDeprecated is added to a proptype
addIsDeprecated(PropTypes).string.isDeprecated('message');
// test: isRequired is still present on that proptype
addIsDeprecated(PropTypes).string.isRequired;