mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 23:53:13 +09:00
Fix bad typings detected by linting
Fix badly typed expressions that were detected by turning on `@typescript-eslint/no-unnecessary-condition` in eslint.
This commit is contained in:
1 parent
90a88f7e01
commit
ec734c92bc
29 files changed
+62
-73
No files matched your search
@@ -4,7 +4,7 @@ import * as lib from "@clusterio/lib";
|
||||
import ControlContext from "../components/ControlContext";
|
||||
|
||||
let exportManifestCache: lib.ExportManifest|null = null;
|
||||
let emptyCache: any = {};
|
||||
let emptyCache = { assets: {} };
|
||||
export function useExportManifest(): lib.ExportManifest|null {
|
||||
const control = useContext(ControlContext);
|
||||
let [exportManifest, setExportManifest] = useState<lib.ExportManifest|null>(exportManifestCache || emptyCache);
|
||||
|
||||
@@ -17,7 +17,6 @@ export function useItemMetadata() {
|
||||
async function load() {
|
||||
if (
|
||||
!exportManifest
|
||||
|| !exportManifest.assets
|
||||
|| !exportManifest.assets["item-metadata"]
|
||||
|| !exportManifest.assets["item-spritesheet"]
|
||||
) {
|
||||
|
||||
@@ -9,7 +9,7 @@ export function useLocale(): Map<string, string> {
|
||||
let [locale, setLocale] = useState<Map<string, string>>(localeCache || new Map());
|
||||
useEffect(() => {
|
||||
async function load() {
|
||||
if (!exportManifest?.assets?.["locale"]) {
|
||||
if (!exportManifest?.assets["locale"]) {
|
||||
return;
|
||||
}
|
||||
let response = await fetch(`${staticRoot}static/${exportManifest.assets["locale"]}`);
|
||||
@@ -27,4 +27,3 @@ export function useLocale(): Map<string, string> {
|
||||
|
||||
return locale;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user