Enfore type on StoryIndex in preview

This commit is contained in:
Tom Coleman 2022-05-09 16:19:13 +10:00
parent 32f2ffbdb2
commit dffce1ec29
5 changed files with 13 additions and 2 deletions

View File

@ -52,7 +52,7 @@ beforeEach(() => {
projectAnnotations.renderToDOM.mockReset();
projectAnnotations.render.mockClear();
projectAnnotations.decorators[0].mockClear();
projectAnnotations.parameters.docs.renderer = () => new DocsRenderer();
projectAnnotations.parameters.docs.renderer = () => new DocsRenderer() as any;
addons.setChannel(mockChannel as any);
addons.setServerChannel(createMockChannel());

View File

@ -55,18 +55,21 @@ export const storyIndex: StoryIndex = {
v: 4,
entries: {
'component-one--a': {
type: 'story',
id: 'component-one--a',
title: 'Component One',
name: 'A',
importPath: './src/ComponentOne.stories.js',
},
'component-one--b': {
type: 'story',
id: 'component-one--b',
title: 'Component One',
name: 'B',
importPath: './src/ComponentOne.stories.js',
},
'component-two--c': {
type: 'story',
id: 'component-two--c',
title: 'Component Two',
name: 'C',

View File

@ -286,6 +286,7 @@ describe('PreviewWeb', () => {
entries: {
...storyIndex.entries,
'component-one--d': {
type: 'story',
id: 'component-one--d',
title: 'Component One',
name: 'D',
@ -336,6 +337,7 @@ describe('PreviewWeb', () => {
entries: {
...storyIndex.entries,
'component-one--d': {
type: 'story',
id: 'component-one--d',
title: 'Component One',
name: 'D',

View File

@ -46,18 +46,21 @@ const storyIndex: StoryIndex = {
v: 4,
entries: {
'component-one--a': {
type: 'story',
id: 'component-one--a',
title: 'Component One',
name: 'A',
importPath: './src/ComponentOne.stories.js',
},
'component-one--b': {
type: 'story',
id: 'component-one--b',
title: 'Component One',
name: 'B',
importPath: './src/ComponentOne.stories.js',
},
'component-two--c': {
type: 'story',
id: 'component-two--c',
title: 'Component Two',
name: 'C',
@ -235,6 +238,7 @@ describe('StoryStore', () => {
entries: {
...storyIndex.entries,
'new-component--story': {
type: 'story',
id: 'new-component--story',
title: 'New Component',
name: 'Story',
@ -266,6 +270,7 @@ describe('StoryStore', () => {
v: 4,
entries: {
'component-one--a': {
type: 'story',
id: 'component-one--a',
title: 'Component One',
name: 'A',
@ -296,6 +301,7 @@ describe('StoryStore', () => {
v: 4,
entries: {
'component-one--a': {
type: 'story',
id: 'component-one--a',
title: 'Component One',
name: 'A',

View File

@ -98,7 +98,7 @@ interface BaseIndexEntry {
importPath: Path;
}
export type StoryIndexEntry = BaseIndexEntry & {
type?: 'story';
type: 'story';
};
export type DocsIndexEntry = BaseIndexEntry & {