diff --git a/src/components/composables/GameSelectionComposable.ts b/src/components/composables/GameSelectionComposable.ts index 5c34606e3..dbf0d9178 100644 --- a/src/components/composables/GameSelectionComposable.ts +++ b/src/components/composables/GameSelectionComposable.ts @@ -120,8 +120,10 @@ export function useGameSelectionComposable() { return; } + const platform = selectedPlatform.value as Platform; + try { - ProviderUtils.setupGameProviders(selectedGame.value, selectedPlatform.value); + ProviderUtils.setupGameProviders(selectedGame.value as Game, platform); } catch (error) { if (error instanceof R2Error) { store.commit('error/handleError', error); @@ -130,10 +132,10 @@ export function useGameSelectionComposable() { throw error; } - const s = await ManagerSettings.getSingleton(selectedGame.value); - await s.setLastSelectedGame(selectedGame.value); - await s.setLastSelectedPlatform(selectedPlatform.value); - await GameManager.activate(selectedGame.value, selectedPlatform.value); + const s = await ManagerSettings.getSingleton(selectedGame.value as Game); + await s.setLastSelectedGame(selectedGame.value as Game); + await s.setLastSelectedPlatform(platform); + await GameManager.activate(selectedGame.value as Game, platform); await store.dispatch('setActiveGame', selectedGame.value); await router.push({ name: 'splash' }); @@ -142,7 +144,7 @@ export function useGameSelectionComposable() { async function selectPlatformForGame(game: Game) { const s = await ManagerSettings.getSingleton(game); const platform = await s.getLastSelectedPlatform(); - selectedPlatform.value = platform ? Platform[platform] : null; + selectedPlatform.value = platform ? Platform[platform as unknown as keyof typeof Platform] : null; } async function initialize() { @@ -168,7 +170,8 @@ export function useGameSelectionComposable() { viewMode.value = GameSelectionViewMode.CARD; } - const { defaultGame, defaultPlatform } = ManagerUtils.getDefaults(settings.value); + const settingsInstance = settings.value as ManagerSettings; + const { defaultGame, defaultPlatform } = ManagerUtils.getDefaults(settingsInstance); if (defaultGame && defaultPlatform) { markAsSelectedGame(defaultGame); selectedPlatform.value = defaultPlatform; @@ -181,8 +184,9 @@ export function useGameSelectionComposable() { return; } - const s = await ManagerSettings.getSingleton(selectedGame.value); - await s.setDefaultGame(selectedGame.value); + const game = selectedGame.value as Game; + const s = await ManagerSettings.getSingleton(game); + await s.setDefaultGame(game); await s.setDefaultStorePlatform(selectedPlatform.value); return proceed(); diff --git a/src/depots/loader/DepotLoader.ts b/src/depots/loader/DepotLoader.ts index 1b50a082e..6b93bbe10 100644 --- a/src/depots/loader/DepotLoader.ts +++ b/src/depots/loader/DepotLoader.ts @@ -31,7 +31,7 @@ export default class DepotLoader { ); } const protonRequired = depots[depotIdentifier] || depots[this.DEPOT_DEFAULT_KEY]; - return protonRequired.use_proton; + return protonRequired!.use_proton; } } diff --git a/src/env.d.ts b/src/env.d.ts index 67bd90d91..38d3bb67a 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -20,7 +20,17 @@ declare namespace NodeJS { declare global { interface Window { - zip: ZipProvider, + zip: { + extractAllTo: (zip: string | Buffer, outputFolder: string) => Promise; + readFile: (zip: string | Buffer, file: string) => Promise; + getEntries: (zip: string | Buffer) => Promise; + extractEntryTo: (zip: string | Buffer, target: string, outputPath: string) => Promise; + zipBuilder: () => ZipBuilder; + createNewTemporaryZip: () => number; + addBufferToTemporaryZip: (id: number, fileName: string, buffer: Buffer) => Promise; + addFolderToTemporaryZip: (id: number, zippedFolderName: string, folderName: string) => Promise; + finalizeTemporaryZip: (id: number, outputPath: string) => Promise; + }, node: { fs: NodeFsProvider, path: NodePathProvider, @@ -44,7 +54,7 @@ declare global { openPath: (path: string) => void; openExternal: (path: string) => void; selectFile: (path: string) => void; - getEnvironmentVariables: () => Record; + getEnvironmentVariables: () => Promise; } } } diff --git a/src/installers/LovelyInstaller.ts b/src/installers/LovelyInstaller.ts index 599e42d0a..05a059d58 100644 --- a/src/installers/LovelyInstaller.ts +++ b/src/installers/LovelyInstaller.ts @@ -32,13 +32,13 @@ export class LovelyInstaller implements PackageInstaller { const targets = lovelyTree.getRecursiveFiles().map((x) => x.replace(packagePath, "")).map((x) => [x, path.join("mods", x)]); for (const target of targets) { - const absSrc = path.join(packagePath, target[0]); - const absDest = profile.joinToProfilePath(target[1]); + const absSrc = path.join(packagePath, target[0]!); + const absDest = profile.joinToProfilePath(target[1]!); await FileUtils.ensureDirectory(path.dirname(absDest)); await fs.copyFile(absSrc, absDest); - fileRelocations.set(absSrc, target[1]); + fileRelocations.set(absSrc, target[1]!); } await addToStateFile(mod, fileRelocations, profile); diff --git a/src/installers/PackageInstaller.ts b/src/installers/PackageInstaller.ts index 0149e6b08..ae72e3aad 100644 --- a/src/installers/PackageInstaller.ts +++ b/src/installers/PackageInstaller.ts @@ -64,7 +64,7 @@ export async function uninstallModLoader(mod: ManifestV2, profile: ImmutableProf const fs = FsProvider.instance; try { - const loader = MOD_LOADER_VARIANTS[GameManager.activeGame.internalFolderName].find( + const loader = MOD_LOADER_VARIANTS[GameManager.activeGame.internalFolderName]!.find( loader => loader.packageName.toLowerCase() === mod.getName().toLowerCase() ); diff --git a/src/installers/ShimloaderInstaller.ts b/src/installers/ShimloaderInstaller.ts index 5abf888c0..a4515ff18 100644 --- a/src/installers/ShimloaderInstaller.ts +++ b/src/installers/ShimloaderInstaller.ts @@ -41,13 +41,13 @@ export class ShimloaderInstaller implements PackageInstaller { } for (const targetPath of targets) { - const absSrc = path.join(packagePath, targetPath[0]); - const absDest = profile.joinToProfilePath(targetPath[1]); + const absSrc = path.join(packagePath, targetPath[0]!); + const absDest = profile.joinToProfilePath(targetPath[1]!); await FileUtils.ensureDirectory(path.dirname(absDest)); await fs.copyFile(absSrc, absDest); - fileRelocations.set(absSrc, targetPath[1]); + fileRelocations.set(absSrc, targetPath[1]!); } // The config subdir needs to be created for shimloader (it will get cranky if it's not there). diff --git a/src/model/ThunderstoreCombo.ts b/src/model/ThunderstoreCombo.ts index f6e4d0ea3..efa8ee899 100644 --- a/src/model/ThunderstoreCombo.ts +++ b/src/model/ThunderstoreCombo.ts @@ -25,7 +25,7 @@ export default class ThunderstoreCombo { ); } - return foundMod[0]; + return foundMod[0]!; } public getMod(): ThunderstoreMod { diff --git a/src/model/ThunderstoreMod.ts b/src/model/ThunderstoreMod.ts index b63bd01e5..a18837613 100644 --- a/src/model/ThunderstoreMod.ts +++ b/src/model/ThunderstoreMod.ts @@ -4,7 +4,6 @@ export default class ThunderstoreMod extends ThunderstoreVersion { private rating: number = 0; private owner: string = ''; private packageUrl: string = ''; - private dateCreated: string = ''; private dateUpdated: string = ''; private uuid4: string = ''; private pinned: boolean = false; @@ -30,7 +29,7 @@ export default class ThunderstoreMod extends ThunderstoreVersion { return a.getDateUpdated() >= b.getDateUpdated() ? -1 : 1; } - public static parseFromThunderstoreData(data: any): ThunderstoreMod { + public static override parseFromThunderstoreData(data: any): ThunderstoreMod { const mod = new ThunderstoreMod(); mod.setName(data.name); mod.setFullName(data.full_name); @@ -115,14 +114,6 @@ export default class ThunderstoreMod extends ThunderstoreVersion { this.packageUrl = url; } - public getDateCreated(): string { - return this.dateCreated; - } - - public setDateCreated(date: string) { - this.dateCreated = date; - } - public getDateUpdated(): string { return this.dateUpdated; } diff --git a/src/model/VersionNumber.ts b/src/model/VersionNumber.ts index 8fcf5d6e6..27a4a9462 100644 --- a/src/model/VersionNumber.ts +++ b/src/model/VersionNumber.ts @@ -25,9 +25,9 @@ export default class VersionNumber { } }); // If successful, assign values. - this.major = numberArray[0]; - this.minor = numberArray[1]; - this.patch = numberArray[2]; + this.major = numberArray[0]!; + this.minor = numberArray[1]!; + this.patch = numberArray[2]!; } catch (e) { // If an error was thrown, log reason. return new VersionNumber('0.0.0'); diff --git a/src/model/errors/FileWriteError.ts b/src/model/errors/FileWriteError.ts index 15b6580a7..c5a42de87 100644 --- a/src/model/errors/FileWriteError.ts +++ b/src/model/errors/FileWriteError.ts @@ -1,7 +1,7 @@ import R2Error from './R2Error'; export default class FileWriteError extends R2Error { - public static fromThrownValue( + public static override fromThrownValue( error: R2Error | Error | unknown, name: string = "An unhandled error occurred", solution: string | null = null, diff --git a/src/model/errors/R2Error.ts b/src/model/errors/R2Error.ts index c3d077501..1fa642c8f 100644 --- a/src/model/errors/R2Error.ts +++ b/src/model/errors/R2Error.ts @@ -4,9 +4,9 @@ interface Action { } export default class R2Error extends Error { - public name: string; - public message: string; - public stack?: string | undefined; + public override name: string; + public override message: string; + public override stack?: string; public solution: string; public errorReferenceString: string | undefined; public action?: Action; @@ -16,7 +16,10 @@ export default class R2Error extends Error { this.name = name; this.message = message; this.solution = solution || ''; - this.stack = new Error().stack; + const stackError = new Error().stack; + if (stackError) { + this.stack = stackError; + } Object.setPrototypeOf(this, R2Error.prototype); } diff --git a/src/model/exports/ExportMod.ts b/src/model/exports/ExportMod.ts index 70ca34540..24c185492 100644 --- a/src/model/exports/ExportMod.ts +++ b/src/model/exports/ExportMod.ts @@ -21,7 +21,7 @@ export default class ExportMod { const name = modStr.match(new RegExp("(.+)-\\d+\\.\\d+\\.\\d+$")); let resolvedName: string; if (name !== null) { - resolvedName = name[1]; + resolvedName = name[1]!; } else { resolvedName = ""; } diff --git a/src/model/file/FileTree.ts b/src/model/file/FileTree.ts index 79ea9b521..ed49a3dbc 100644 --- a/src/model/file/FileTree.ts +++ b/src/model/file/FileTree.ts @@ -82,7 +82,7 @@ export default class FileTree { public navigate(...args: string[]): FileTree | undefined { if (args[0] !== undefined) { - const foundDir = this.directories.find(value => value.directoryName.toLowerCase() === args[0].toLowerCase()); + const foundDir = this.directories.find(value => value.directoryName.toLowerCase() === args[0]!.toLowerCase()); if (foundDir !== undefined) { return foundDir.subNavigate(...args.splice(1)); } @@ -91,7 +91,7 @@ export default class FileTree { private subNavigate(...args: string[]): FileTree | undefined { if (args[0] !== undefined) { - const foundDir = this.directories.find(value => value.directoryName.toLowerCase() === args[0].toLowerCase()); + const foundDir = this.directories.find(value => value.directoryName.toLowerCase() === args[0]!.toLowerCase()); if (foundDir !== undefined) { return foundDir.subNavigate(...args.splice(1)); } diff --git a/src/model/game/Game.ts b/src/model/game/Game.ts index 57895b6c8..a04b4bb3b 100644 --- a/src/model/game/Game.ts +++ b/src/model/game/Game.ts @@ -48,7 +48,7 @@ export default class Game { this._thunderstoreUrl = tsUrl; this._thunderstoreIdentifier = tsIdentifier; this._storePlatformMetadata = platforms; - this._activePlatform = platforms[0]; + this._activePlatform = platforms[0]!; this._iconUrl = iconUrl; this._displayMode = displayMode; this._instanceType = instanceType; diff --git a/src/providers/generic/zip/AdmZipProvider.ts b/src/providers/generic/zip/AdmZipProvider.ts index 02481431c..c26bbdc17 100644 --- a/src/providers/generic/zip/AdmZipProvider.ts +++ b/src/providers/generic/zip/AdmZipProvider.ts @@ -23,6 +23,8 @@ export default class AdmZipProvider extends ZipProvider { zipBuilder(): ZipBuilder { return new AdmZipBuilder(); } + + } export class AdmZipBuilder extends ZipBuilder { diff --git a/src/providers/generic/zip/ZipProvider.ts b/src/providers/generic/zip/ZipProvider.ts index 4246e7fea..14114c91c 100644 --- a/src/providers/generic/zip/ZipProvider.ts +++ b/src/providers/generic/zip/ZipProvider.ts @@ -27,4 +27,3 @@ export default abstract class ZipProvider { public abstract zipBuilder(): ZipBuilder; } - diff --git a/src/providers/node/path/NodePathImplementation.ts b/src/providers/node/path/NodePathImplementation.ts index cd3227576..187c13849 100644 --- a/src/providers/node/path/NodePathImplementation.ts +++ b/src/providers/node/path/NodePathImplementation.ts @@ -8,6 +8,7 @@ export const NodePathImplementation: NodePathProvider = { dirname: (...args) => window.node.path.dirname(...args), resolve: (...args) => window.node.path.resolve(...args), get sep() { + // @ts-ignore return window.node.path.sep() } } diff --git a/src/r2mm/downloading/BetterThunderstoreDownloader.ts b/src/r2mm/downloading/BetterThunderstoreDownloader.ts index 133460ce3..b550e1ad6 100644 --- a/src/r2mm/downloading/BetterThunderstoreDownloader.ts +++ b/src/r2mm/downloading/BetterThunderstoreDownloader.ts @@ -23,7 +23,7 @@ export default class BetterThunderstoreDownloader extends ThunderstoreDownloader throw new R2Error('No mods to download', 'An empty list of mods was passed to the downloader'); } - let modInProgressName = combos[0].getMod().getName(); + let modInProgressName = combos[0]!.getMod().getName(); let finishedModsDownloadedSize = 0; const singleModProgressCallback = (downloadedBytes: number, status: DownloadStatusEnum, err: R2Error | null) => { diff --git a/src/r2mm/manager/ManagerSettings.ts b/src/r2mm/manager/ManagerSettings.ts index 978760a00..2952b2741 100644 --- a/src/r2mm/manager/ManagerSettings.ts +++ b/src/r2mm/manager/ManagerSettings.ts @@ -130,7 +130,7 @@ export default class ManagerSettings { public getInstalledSortBy() { try { - return Object.entries(SortNaming).filter(value => value[0] === ManagerSettings.CONTEXT.gameSpecific.installedSortBy)[0][1]; + return Object.entries(SortNaming).filter(value => value[0] === ManagerSettings.CONTEXT.gameSpecific.installedSortBy)[0]![1]; } catch (e) { console.log("Failed to get installedSortBy:", e); return SortNaming.CUSTOM; @@ -144,7 +144,7 @@ export default class ManagerSettings { public getInstalledSortDirection() { try { - return Object.entries(SortDirection).filter(value => value[0] === ManagerSettings.CONTEXT.gameSpecific.installedSortDirection)[0][1]; + return Object.entries(SortDirection).filter(value => value[0] === ManagerSettings.CONTEXT.gameSpecific.installedSortDirection)[0]![1]; } catch (e) { console.log("Failed to get installedSortDirection:", e); return SortDirection.STANDARD; @@ -158,7 +158,7 @@ export default class ManagerSettings { public getInstalledDisablePosition() { try { - return Object.entries(SortLocalDisabledMods).filter(value => value[0] === ManagerSettings.CONTEXT.gameSpecific.installedDisablePosition)[0][1]; + return Object.entries(SortLocalDisabledMods).filter(value => value[0] === ManagerSettings.CONTEXT.gameSpecific.installedDisablePosition)[0]![1]; } catch (e) { console.log("Failed to get installedDisablePosition:", e); return SortLocalDisabledMods.CUSTOM; diff --git a/src/r2mm/manager/PackageDexieStore.ts b/src/r2mm/manager/PackageDexieStore.ts index d25a90bea..673fb52de 100644 --- a/src/r2mm/manager/PackageDexieStore.ts +++ b/src/r2mm/manager/PackageDexieStore.ts @@ -18,9 +18,9 @@ interface IndexChunkHash { } class PackageDexieStore extends Dexie { - packages!: Table; + packages!: Table; indexHashes!: Table; - summaries!: Table; + summaries!: Table; constructor() { super('tsPackages'); diff --git a/src/r2mm/system/DataFolderProviderImpl.ts b/src/r2mm/system/DataFolderProviderImpl.ts index 17d92b3ea..8fc807288 100644 --- a/src/r2mm/system/DataFolderProviderImpl.ts +++ b/src/r2mm/system/DataFolderProviderImpl.ts @@ -25,7 +25,7 @@ export class DataFolderProviderImpl extends DataFolderProvider { } if (files.length === 1) { - return files[0]; + return files[0]!; } // Shouldn't be possible to select multiple folders but someone always finds a way. diff --git a/src/r2mm/system/InteractionProviderImpl.ts b/src/r2mm/system/InteractionProviderImpl.ts index 4118f1745..0f8f1fcee 100644 --- a/src/r2mm/system/InteractionProviderImpl.ts +++ b/src/r2mm/system/InteractionProviderImpl.ts @@ -26,6 +26,7 @@ export default class InteractionProviderImpl extends InteractionProvider { } async getEnvironmentVariables() { - return JSON.parse((await window.electron.getEnvironmentVariables())); + const envVars = await window.electron.getEnvironmentVariables(); + return JSON.parse(envVars); } } diff --git a/src/store/index.ts b/src/store/index.ts index 6bea43128..4de52fc91 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -3,11 +3,11 @@ import { ActionContext, createStore } from 'vuex'; import ErrorModule from './modules/ErrorModule'; import { DownloadModule } from './modules/DownloadModule'; import ModalsModule from './modules/ModalsModule'; -import ModFilterModule from './modules/ModFilterModule'; +import ModFilterModule, { State as ModFilterState } from './modules/ModFilterModule'; import ProfileModule from './modules/ProfileModule'; import ProfileExportModule from './modules/ProfileExportModule'; import { ProfilesModule } from './modules/ProfilesModule'; -import { TsModsModule } from './modules/TsModsModule'; +import { TsModsModule, State as TsModsState } from './modules/TsModsModule'; import { FolderMigration } from '../migrations/FolderMigration'; import Game from '../model/game/Game'; import GameManager from '../model/game/GameManager'; @@ -22,6 +22,8 @@ export interface State { isMigrationChecked: boolean; modLoaderPackageNames: string[]; _settings: ManagerSettings | null; + modFilters: ModFilterState; + tsMods: TsModsState; } type Context = ActionContext; @@ -39,7 +41,7 @@ export const store = { // Access through getters to ensure the settings are loaded. _settings: null, - }, + } as unknown as State, actions: { async checkMigrations({commit, state}: Context) { if (state.isMigrationChecked) { diff --git a/src/store/modules/DownloadModule.ts b/src/store/modules/DownloadModule.ts index 02c10c5f3..aad88dd60 100644 --- a/src/store/modules/DownloadModule.ts +++ b/src/store/modules/DownloadModule.ts @@ -285,9 +285,9 @@ export const DownloadModule = { if (index > -1) { const newDownloads = [...state.allDownloads]; if (update.downloadedSize !== undefined) { - update.downloadProgress = DownloadUtils.generateProgressPercentage(update.downloadedSize, newDownloads[index].totalDownloadSize); + update.downloadProgress = DownloadUtils.generateProgressPercentage(update.downloadedSize, newDownloads[index]!.totalDownloadSize); } - newDownloads[index] = {...newDownloads[index], ...update}; + newDownloads[index] = {...newDownloads[index]!, ...update}; state.allDownloads = newDownloads; } }, @@ -336,7 +336,7 @@ function getOnlyActiveDownloads(downloads: DownloadProgress[]): DownloadProgress function updateDownloadStatus(downloads: DownloadProgress[], downloadId: UUID, status: DownloadStatusEnum): DownloadProgress[] { const index: number = getIndexOfDownloadProgress(downloads, downloadId); if (index > -1) { - downloads[index].status = status; + downloads[index]!.status = status; } return downloads; } diff --git a/src/store/modules/ModFilterModule.ts b/src/store/modules/ModFilterModule.ts index 6d28fd7bf..b8d4d7d80 100644 --- a/src/store/modules/ModFilterModule.ts +++ b/src/store/modules/ModFilterModule.ts @@ -4,7 +4,7 @@ import { State as RootState } from '../index'; import { SortDirection } from '../../model/real_enums/sort/SortDirection'; import SortingStyle from '../../model/enums/SortingStyle'; -interface State { +export interface State { allowNsfw: boolean; selectedCategoriesCompareOne: string[]; selectedCategoriesCompareAll: string[]; diff --git a/src/store/modules/ProfileExportModule.ts b/src/store/modules/ProfileExportModule.ts index c4b5c7a5e..c0c746d87 100644 --- a/src/store/modules/ProfileExportModule.ts +++ b/src/store/modules/ProfileExportModule.ts @@ -5,7 +5,7 @@ import { ActionTree, MutationTree } from 'vuex'; import { State as RootState } from '../../store'; interface State { - exportCode?: string; + exportCode?: string | undefined; } export default { diff --git a/src/store/modules/ProfileModule.ts b/src/store/modules/ProfileModule.ts index 4c1210d40..06de50e35 100644 --- a/src/store/modules/ProfileModule.ts +++ b/src/store/modules/ProfileModule.ts @@ -31,9 +31,9 @@ interface State { expandedByDefault: boolean; funkyMode: boolean; modList: ManifestV2[]; - order?: SortNaming; - direction?: SortDirection; - disabledPosition?: SortLocalDisabledMods; + order?: SortNaming | undefined; + direction?: SortDirection | undefined; + disabledPosition?: SortLocalDisabledMods | undefined; searchQuery: string; dismissedUpdateAll: boolean; } diff --git a/src/store/modules/TsModsModule.ts b/src/store/modules/TsModsModule.ts index 2c6e4607d..5efa96420 100644 --- a/src/store/modules/TsModsModule.ts +++ b/src/store/modules/TsModsModule.ts @@ -19,14 +19,14 @@ export interface CachedMod { isLatest: boolean; } -interface State { +export interface State { activeGameCacheStatus: string|undefined; cache: Map; deprecated: Map; exclusions: string[]; isThunderstoreModListUpdateInProgress: boolean; mods: ThunderstoreMod[]; - modsLastUpdated?: Date; + modsLastUpdated?: Date | undefined; thunderstoreModListUpdateError: Error|undefined; thunderstoreModListUpdateStatus: string; } diff --git a/src/types/shell-quote.d.ts b/src/types/shell-quote.d.ts new file mode 100644 index 000000000..d454ed44a --- /dev/null +++ b/src/types/shell-quote.d.ts @@ -0,0 +1,4 @@ +declare module 'shell-quote' { + export function parse(cmd: string): string[]; + export function quote(args: string[]): string; +} diff --git a/src/utils/BepInExConfigUtils.ts b/src/utils/BepInExConfigUtils.ts index fa9b66b8d..77146bf61 100644 --- a/src/utils/BepInExConfigUtils.ts +++ b/src/utils/BepInExConfigUtils.ts @@ -41,7 +41,7 @@ export default class BepInExConfigUtils { allowedValues.forEach(value => { finalAcceptableValues.push(value.toString()); }) - dumpedConfigVariables[section][sides[0].trim()] = new ConfigLine(rightSide.trim(), comments, finalAcceptableValues); + dumpedConfigVariables[section]![sides[0]!.trim()] = new ConfigLine(rightSide.trim(), comments, finalAcceptableValues); comments = []; allowedValues.clear(); } else if (line.trim().startsWith('#') || line.trim().startsWith(";")) { @@ -61,7 +61,7 @@ export default class BepInExConfigUtils { builtString += line + '\n'; } else if (!(line.trim().startsWith('#') || line.trim().startsWith(";")) && line.indexOf('=') > 0) { const sides = line.split('='); - builtString += `${sides[0].trim()} = ${data[section][sides[0].trim()].value}\n`; + builtString += `${sides[0]!.trim()} = ${data[section]![sides[0]!.trim()]!.value}\n`; } else { builtString += line + '\n'; } diff --git a/src/utils/Common.ts b/src/utils/Common.ts index 9e0332c58..571a76383 100644 --- a/src/utils/Common.ts +++ b/src/utils/Common.ts @@ -12,13 +12,13 @@ export const getPropertyFromPath = (object: Mappable, path: string | string[]): if (!object) { return undefined; } - const key = parts[i]; + const key = parts[i]!; object = object[key]; } return object; } for (let i = 0; i < path.length; i++) { - const res = getPropertyFromPath(object, path[i]); + const res = getPropertyFromPath(object, path[i]!); if (res) { return res; }