فهرست منبع

fix: lint errors

Sv443 1 سال پیش
والد
کامیت
1bbe911669
1فایلهای تغییر یافته به همراه4 افزوده شده و 3 حذف شده
  1. 4 3
      src/config.ts

+ 4 - 3
src/config.ts

@@ -65,15 +65,16 @@ export const migrations: DataMigrationsDict = {
 
 export const defaultData = (Object.keys(featInfo) as (keyof typeof featInfo)[])
   .reduce<Partial<FeatureConfig>>((acc, key) => {
-    acc[key] = featInfo[key].default as unknown as undefined;
+    // @ts-ignore
+    acc[key] = featInfo?.[key]?.default as unknown as undefined;
     return acc;
   }, {}) as FeatureConfig;
 
 /** Uses the default config as the base, then overwrites all values with the passed {@linkcode baseData}, then sets all passed {@linkcode resetKeys} to their default values */
 function useDefaultConfig(resetKeys: (keyof typeof featInfo)[], baseData?: FeatureConfig): Partial<FeatureConfig> {
   const newData = { ...defaultData, ...(baseData ?? {}) };
-  for(const key of resetKeys)
-    newData[key] = featInfo[key].default as never; // typescript funny moments
+  for(const key of resetKeys) // @ts-ignore
+    newData[key] = featInfo?.[key]?.default as never; // typescript funny moments
   return newData;
 }