From 043cc9f12c2a95d97926bc612c21900a2ab31260 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Sun, 17 Jul 2022 17:36:36 +0530 Subject: [PATCH] Use ThemeManifest type --- src/platform/web/ThemeBuilder.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/platform/web/ThemeBuilder.ts b/src/platform/web/ThemeBuilder.ts index b093deb3..b6f75be4 100644 --- a/src/platform/web/ThemeBuilder.ts +++ b/src/platform/web/ThemeBuilder.ts @@ -33,12 +33,15 @@ export class ThemeBuilder { this._platform = platform; } - async populateDerivedTheme(manifest) { - const { manifest: baseManifest, location } = this._idToManifest.get(manifest.extends)!; + async populateDerivedTheme(manifest: ThemeManifest) { + const { manifest: baseManifest, location } = this._idToManifest.get(manifest.extends!)!; const { cssLocation, derivedVariables, icons } = this._getsourceData(baseManifest, location); const themeName = manifest.name; + if (!themeName) { + throw new Error(`Theme name not found in manifest!`); + } let defaultDarkVariant: any = {}, defaultLightVariant: any = {}; - for (const [variant, variantDetails] of Object.entries(manifest.values.variants) as [string, any][]) { + for (const [variant, variantDetails] of Object.entries(manifest.values?.variants!) as [string, any][]) { try { const themeId = `${manifest.id}-${variant}`; const { name: variantName, default: isDefault, dark, variables } = variantDetails;