improve PropTypes for better rageshakes

This commit is contained in:
Michael Telatynski 2020-01-29 07:53:45 +00:00
parent 83fdeeb180
commit 3d47e25955
2 changed files with 20 additions and 2 deletions

View file

@ -14,7 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import React from 'react'; import React from "react";
import PropTypes from "prop-types";
import * as sdk from '../../../index'; import * as sdk from '../../../index';
import {verificationMethods} from 'matrix-js-sdk/src/crypto'; import {verificationMethods} from 'matrix-js-sdk/src/crypto';
@ -23,6 +24,8 @@ import {MatrixClientPeg} from "../../../MatrixClientPeg";
import {_t} from "../../../languageHandler"; import {_t} from "../../../languageHandler";
import E2EIcon from "../rooms/E2EIcon"; import E2EIcon from "../rooms/E2EIcon";
import { import {
PHASE_UNSENT,
PHASE_REQUESTED,
PHASE_READY, PHASE_READY,
PHASE_DONE, PHASE_DONE,
PHASE_STARTED, PHASE_STARTED,
@ -31,6 +34,20 @@ import {
import Spinner from "../elements/Spinner"; import Spinner from "../elements/Spinner";
export default class VerificationPanel extends React.PureComponent { export default class VerificationPanel extends React.PureComponent {
static propTypes = {
request: PropTypes.object.isRequired,
member: PropTypes.object.isRequired,
phase: PropTypes.oneOf([
PHASE_UNSENT,
PHASE_REQUESTED,
PHASE_READY,
PHASE_STARTED,
PHASE_CANCELLED,
PHASE_DONE,
]).isRequired,
onClose: PropTypes.func.isRequired,
};
constructor(props) { constructor(props) {
super(props); super(props);
this.state = {}; this.state = {};

View file

@ -27,7 +27,8 @@ function capFirst(s) {
export default class VerificationShowSas extends React.Component { export default class VerificationShowSas extends React.Component {
static propTypes = { static propTypes = {
displayName: PropTypes.string.isRequired, pending: PropTypes.bool,
displayName: PropTypes.string, // required if pending is true
onDone: PropTypes.func.isRequired, onDone: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired, onCancel: PropTypes.func.isRequired,
sas: PropTypes.object.isRequired, sas: PropTypes.object.isRequired,