Skip to content

Commit

Permalink
fix(types)
Browse files Browse the repository at this point in the history
  • Loading branch information
Delusoire committed Aug 24, 2024
1 parent bba191f commit e9ae40e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,10 @@ export class ModuleInstance extends ModuleInstanceBase<Module>
try {
const storeUrl = this.getMetadataURL()!;
const metadata = await fetchJson<Metadata>(storeUrl);
this.updateMetadata(metadata);
if (!metadata) {
throw new Error(`metadata is null`);
}
this.updateMetadata(metadata!);
} catch (e) {
throw new Error(
`couldn't load metadata for module '${this.getIdentifier()}'`,
Expand Down Expand Up @@ -996,10 +999,12 @@ export const INTERNAL_TRANSFORMER = createTransformer(INTERNAL_MIXIN_LOADER);
export async function loadLocalModules() {
const localModules = [
await fetchJson<_Vault>("/modules/vault.json"),
].reduceRight<_Vault["modules"]>(
(acc, vault) => deepMerge(acc, vault.modules),
{},
);
]
.filter(Boolean)
.reduceRight<_Vault["modules"]>(
(acc, vault) => deepMerge(acc, vault!.modules),
{},
);

return Promise.all(
Object.keys(localModules).map((identifier) =>
Expand All @@ -1020,10 +1025,12 @@ export async function loadRemoteModules() {
await fetchJson<_Vault>(
"https://raw.githubusercontent.com/spicetify/pkgs/main/vault.json",
),
].reduceRight<_Vault["modules"]>(
(acc, vault) => deepMerge(acc, vault.modules),
{},
);
]
.filter(Boolean)
.reduceRight<_Vault["modules"]>(
(acc, vault) => deepMerge(acc, vault!.modules),
{},
);

await Promise.all(
Object.keys(remoteModules).map(async (identifier) => {
Expand Down

0 comments on commit e9ae40e

Please sign in to comment.