mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-24 21:24:05 -08:00
upgrade react-app to typescript 4
Signed-off-by: Augustin Husson <husson.augustin@gmail.com>
This commit is contained in:
parent
143fce73cd
commit
405198f430
14
web/ui/react-app/package-lock.json
generated
14
web/ui/react-app/package-lock.json
generated
|
@ -77,7 +77,7 @@
|
|||
"prettier": "^2.3.2",
|
||||
"react-scripts": "4.0.3",
|
||||
"sinon": "^9.0.3",
|
||||
"typescript": "^3.3.3"
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "^2.3.2"
|
||||
|
@ -22808,9 +22808,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "3.9.10",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
||||
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
|
@ -43168,9 +43168,9 @@
|
|||
}
|
||||
},
|
||||
"typescript": {
|
||||
"version": "3.9.10",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz",
|
||||
"integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==",
|
||||
"version": "4.4.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.2.tgz",
|
||||
"integrity": "sha512-gzP+t5W4hdy4c+68bfcv0t400HVJMMd2+H9B7gae1nQlBzCqvrXX+6GL/b3GAgyTH966pzrZ70/fRjwAtZksSQ==",
|
||||
"dev": true
|
||||
},
|
||||
"unbox-primitive": {
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
"prettier": "^2.3.2",
|
||||
"react-scripts": "4.0.3",
|
||||
"sinon": "^9.0.3",
|
||||
"typescript": "^3.3.3"
|
||||
"typescript": "^4.4.2"
|
||||
},
|
||||
"proxy": "http://localhost:9090",
|
||||
"jest": {
|
||||
|
|
|
@ -34,7 +34,8 @@ export const useFetch = <T extends Record<string, any>>(url: string, options?: R
|
|||
const json = (await res.json()) as APIResponse<T>;
|
||||
setResponse(json);
|
||||
setIsLoading(false);
|
||||
} catch (error) {
|
||||
} catch (err: unknown) {
|
||||
const error = err as Error;
|
||||
setError(error);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -200,7 +200,8 @@ class Panel extends Component<PanelProps, PanelState> {
|
|||
loading: false,
|
||||
});
|
||||
this.abortInFlightFetch = null;
|
||||
} catch (error) {
|
||||
} catch (err: unknown) {
|
||||
const error = err as Error;
|
||||
if (error.name === 'AbortError') {
|
||||
// Aborts are expected, don't show an error for them.
|
||||
return;
|
||||
|
|
|
@ -10,10 +10,11 @@ const EndpointLink: FC<EndpointLinkProps> = ({ endpoint, globalUrl }) => {
|
|||
let url: URL;
|
||||
try {
|
||||
url = new URL(endpoint);
|
||||
} catch (e) {
|
||||
} catch (err: unknown) {
|
||||
const error = err as Error;
|
||||
return (
|
||||
<Alert color="danger">
|
||||
<strong>Error:</strong> {e.message}
|
||||
<strong>Error:</strong> {error.message}
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react",
|
||||
"jsx": "react-jsx",
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": [
|
||||
|
|
Loading…
Reference in a new issue