fix types

This commit is contained in:
Norbert de Langen 2022-11-25 09:46:19 +01:00
parent 82906d156e
commit 0b99973bb0
No known key found for this signature in database
GPG Key ID: FD0E78AF9A837762

View File

@ -60,34 +60,33 @@ export class StoryStoreFacade<TRenderer extends Renderer> {
const storyEntries = Object.entries(this.entries); const storyEntries = Object.entries(this.entries);
// Add the kind parameters and global parameters to each entry // Add the kind parameters and global parameters to each entry
const sortableV6: [StoryId, PreparedStory<TRenderer>, Parameters, Parameters][] = const sortableV6 = storyEntries.map(([storyId, { type, importPath, ...entry }]) => {
storyEntries.map(([storyId, { type, importPath, ...entry }]) => { const exports = this.csfExports[importPath];
const exports = this.csfExports[importPath]; const csfFile = store.processCSFFileWithCache<TRenderer>(
const csfFile = store.processCSFFileWithCache<TRenderer>( exports,
exports, importPath,
importPath, exports.default.title
exports.default.title );
);
let storyLike: PreparedStory<TRenderer>; let storyLike: PreparedStory<TRenderer>;
if (type === 'story') { if (type === 'story') {
storyLike = store.storyFromCSFFile({ storyId, csfFile }); storyLike = store.storyFromCSFFile({ storyId, csfFile });
} else { } else {
storyLike = { storyLike = {
...entry, ...entry,
story: entry.name, story: entry.name,
kind: entry.title, kind: entry.title,
componentId: toId(entry.componentId || entry.title), componentId: toId(entry.componentId || entry.title),
parameters: { fileName: importPath }, parameters: { fileName: importPath },
} as any; } as any;
} }
return [ return [
storyId, storyId,
storyLike, storyLike,
csfFile.meta.parameters, csfFile.meta.parameters,
this.projectAnnotations.parameters || {}, this.projectAnnotations.parameters || {},
]; ] as [StoryId, PreparedStory<TRenderer>, Parameters, Parameters];
}); });
// NOTE: the sortStoriesV6 version returns the v7 data format. confusing but more convenient! // NOTE: the sortStoriesV6 version returns the v7 data format. confusing but more convenient!
let sortedV7: IndexEntry[]; let sortedV7: IndexEntry[];