Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toplevel expression is expected to have unit type #21

Open
painedpineapple opened this issue Jan 27, 2021 · 1 comment
Open

Toplevel expression is expected to have unit type #21

painedpineapple opened this issue Jan 27, 2021 · 1 comment

Comments

@painedpineapple
Copy link

painedpineapple commented Jan 27, 2021

I installed this via https://github.com/draftbit/bs-storybook to workaround #13. I am only attempting to write the basic story example when running into this error.

  3let _module = %bs.raw("module")
  45storiesOf("My First Reason Story", _module)->add("Chapter I", () =>
  6 │   <span> {React.string("Hello bs-storybook!")} </span>
  7 │ )
  
  Toplevel expression is expected to have unit type.
  
FAILED: cannot make progress due to previous errors.
>>>> Finish compiling(exit: 1)

The word add on line 5 is what's highlighted in the error by the ReScript compiler

Using "bs-platform": "^8.4.2",

@mishaszu mishaszu mentioned this issue Mar 22, 2021
@mishaszu
Copy link

mishaszu commented Mar 22, 2021

It seems like a fast pipe in the example doesn't work as expected and the add method returns while the module or function that contains the story shouldn't. I'm not that good with ReasonML to explain why.
If you change to:

let my_section = storiesOf("My First Reason Story", _module);
let _ = add(my_section ,"Chapter I", () =><span> {React.string("Hello bs-storybook!")} </span>);

It should work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants