jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.28k stars 507 forks source link

Storybook error when no title #785

Closed deadcoder0904 closed 4 years ago

deadcoder0904 commented 4 years ago

Current Behavior

Getting an error:

Unexpected default export without title: {"parameters":{"storySource":{"source":"import React from 'react';\nimport { ReactTypical, Props } from '../src';\n\nexport default {\n steps: [\n 'Hey',\n 5000,\n 'you',\n 5000,\n 'have',\n 5000,\n 'a',\n 5000,\n 'blessed',\n 5000,\n 'day',\n ],\n loop: Infinity,\n};\n\n// By passing optional props to this story, you can control the props of the component when\n// you consume the story in a test.\nexport const Default = (props?: Props) => <ReactTypical {...props} />;\n","locationsMap":{}}},"steps":["Hey",5000,"you",5000,"have",5000,"a",5000,"blessed",5000,"day"],"loop":null}

Expected behavior

Storybook should work as expected. I only changed a few lines of code from the original template. Even the tests that look exactly like Storybook work.

Here's my entire repro → https://github.com/deadcoder0904/react-typical

Relevant storybook bit (ReactTypical.stories.tsx):

import React from 'react';
import { ReactTypical, Props } from '../src';

export default {
  steps: [
    'Hey',
    5000,
    'you',
    5000,
    'have',
    5000,
    'a',
    5000,
    'blessed',
    5000,
    'day',
  ],
  loop: Infinity,
};

// By passing optional props to this story, you can control the props of the component when
// you consume the story in a test.
export const Default = (props?: Props) => <ReactTypical {...props} />;

Your environment

Software Version(s)
TSDX 0.13.2
TypeScript 3.9.7
Browser Chrome v84.0.4147.105 (Official Build) (64-bit)
npm. 6.14.4
Node 14.4.0
Operating System Mac OS 10.15.6
agilgur5 commented 4 years ago

It tells you what the error is...

Unexpected default export without title:

You need a title. The template has a title: https://github.com/formium/tsdx/blob/5e5c3f804e68609083be978a080ab905dc7ec19d/templates/react-with-storybook/stories/Thing.stories.tsx#L5

Also if this were a bug, it wouldn't be a TSDX bug, it's purely Storybook.

deadcoder0904 commented 4 years ago

@agilgur5 where does the title come from? I don't have a prop with the name title.

I saw storybook but the examples there were different, would love to know if there's any repo that uses tsdx & storybook so I can read the code :)

deadcoder0904 commented 4 years ago

Oops, the title isn't a prop I see, gotcha 👍

agilgur5 commented 4 years ago

Again, this isn't a bug, and is strictly Storybook, not TSDX related. Issues are also not a forum for help with debugging your own code.