migrate ui-components from flow to typescript

This commit is contained in:
Sebastian Sdorra
2019-10-20 16:59:02 +02:00
parent c41efbdc4f
commit f49e17a3a7
151 changed files with 2039 additions and 25265 deletions

View File

@@ -1,8 +1,8 @@
import React from 'react';
import { Changeset } from '@scm-manager/ui-types';
import LoadingDiff from '../LoadingDiff';
import Notification from '../../Notification';
import { translate } from 'react-i18next';
import React from "react";
import { Changeset, Link } from "@scm-manager/ui-types";
import LoadingDiff from "../LoadingDiff";
import Notification from "../../Notification";
import { translate } from "react-i18next";
type Props = {
changeset: Changeset;
@@ -18,7 +18,11 @@ class ChangesetDiff extends React.Component<Props> {
}
createUrl(changeset: Changeset) {
return changeset._links.diff.href + '?format=GIT';
if (changeset._links.diff) {
const link = changeset._links.diff as Link;
return link.href + "?format=GIT";
}
throw new Error("diff link is missing");
}
render() {
@@ -26,7 +30,7 @@ class ChangesetDiff extends React.Component<Props> {
if (!this.isDiffSupported(changeset)) {
return (
<Notification type="danger">
{t('changeset.diffNotSupported')}
{t("changeset.diffNotSupported")}
</Notification>
);
} else {
@@ -36,4 +40,4 @@ class ChangesetDiff extends React.Component<Props> {
}
}
export default translate('repos')(ChangesetDiff);
export default translate("repos")(ChangesetDiff);