Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
MM-20404 Migrate 'components/announcement_bar/version_bar' module and…
Browse files Browse the repository at this point in the history
… associated tests to TypeScript
  • Loading branch information
tianlangwu committed Nov 2, 2020
1 parent 6c3c2d1 commit 3b2e29c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions components/announcement_bar/version_bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// See LICENSE.txt for license information.

import {connect} from 'react-redux';

import {GlobalState} from 'mattermost-redux/types/store';
import VersionBar from './version_bar';

function mapStateToProps(state:any) {
function mapStateToProps(state:GlobalState) {
return {
serverVersion: state.entities.general.serverVersion,
};
Expand Down
14 changes: 7 additions & 7 deletions components/announcement_bar/version_bar/version_bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ import {AnnouncementBarTypes} from 'utils/constants';

import AnnouncementBar from '../default_announcement_bar';

interface IMyComponentProps {
serverVersion?: string,
interface Props {
serverVersion: string,
}

interface IMyComponentState {
serverVersionOnAppLoad?: string,
interface State {
serverVersionOnAppLoad: string,
}

export default class VersionBar extends React.PureComponent <IMyComponentProps, IMyComponentState> {
constructor(props:IMyComponentProps) {
export default class VersionBar extends React.PureComponent <Props, State> {
constructor(props:Props) {
super(props);

this.state = {
serverVersionOnAppLoad: props.serverVersion,
};
}

static getDerivedStateFromProps(props:IMyComponentProps, state:IMyComponentState) {
static getDerivedStateFromProps(props:Props, state:State) {
if (!state.serverVersionOnAppLoad && props.serverVersion) {
return {
serverVersionOnAppLoad: props.serverVersion,
Expand Down
2 changes: 1 addition & 1 deletion utils/server_version.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* 4.7.0.dev.3034fbc5fd566195d1b53e03890e35ff.true
* 4.7.1.dev.d131dd02c5e6eec4693d9a0698aff95c.true
*/
export function equalServerVersions(a?: string, b?: string): boolean {
export function equalServerVersions(a: string, b: string): boolean {
if (a === b) {
return true;
}
Expand Down

0 comments on commit 3b2e29c

Please sign in to comment.