chore(ui): migrate more code to typescript

This commit is contained in:
Łukasz Mierzwa
2020-07-17 11:58:41 +01:00
committed by Łukasz Mierzwa
parent 55170f8812
commit 4d4dd111c1
36 changed files with 392 additions and 205 deletions
@@ -1,4 +1,4 @@
function IsMobile() {
function IsMobile(): boolean {
return window.innerWidth < 768;
}
@@ -14,7 +14,13 @@ const FetchRetryConfig = {
maxTimeout: 5000,
};
const FetchGet = async (uri, options, beforeRetry) =>
type PreRetryCallback = (number: number) => void;
const FetchGet = async (
uri: string,
options: RequestInit,
beforeRetry: PreRetryCallback
) =>
await promiseRetry(
(retry, number) =>
fetch(
@@ -14,7 +14,7 @@ const StaticLabels = Object.freeze({
SilenceID: "@silence_id",
});
function FormatQuery(name, operator, value) {
function FormatQuery(name: string, operator: string, value: string) {
return `${name}${operator}${value}`;
}
-5
View File
@@ -1,5 +0,0 @@
const NewLabelName = (v) => `New label: ${v}`;
const NewLabelValue = (v) => `New value: ${v}`;
export { NewLabelName, NewLabelValue };
+5
View File
@@ -0,0 +1,5 @@
const NewLabelName = (v: string) => `New label: ${v}`;
const NewLabelValue = (v: string) => `New value: ${v}`;
export { NewLabelName, NewLabelValue };