storybookjs / solidjs

SolidJS integration for Storybook, maintained by the community
MIT License
44 stars 2 forks source link

[Bug] Typescript args type does not work by default with yarn PnP #8

Open olivercoad opened 4 months ago

olivercoad commented 4 months ago

Describe the bug

In my project, type checking of args doesn't work, it never shows any type errors, and the type of props for the render function fails to be inferred, giving an error about being inferred as any.

By starting small with https://github.com/elite174/storybook-solid-js and changing things I was able to reproduce it when enabling yarn plug-n-play.

A workaround is to explicitly install the @storybook/types dependency, which I can't find documented anywhere. No idea why or how that works, but it seems to fix the errors. There are still a bunch of type errors in storybook-solidjs/dist/index.d.ts, but they can be silenced with "skipLibCheck": true in the tsconfig.

Steps to reproduce the behavior

  1. Clone elite174/storybook-solid-js (https://github.com/elite174/storybook-solid-js/commit/b4eee6a1e278bb289455cc4665669063652cb80d at the time of writing issue)
  2. yarn set version 4.1.1 - this sets yarn as the package manager and using PnP
  3. Change typescript to use exactly version "5.3.2" in package.json - it has issues unrelated to storybook >= 5.4
  4. yarn install
  5. yarn dlx @yarnpkg/sdks vscode then in vscode, select typescript version use workspace through yarn, make sure it's 5.3.2
  6. Fix the first line of Counter.stories.tsx to use "storybook-solidjs"
  7. Add what should be a type error in one of the args, and observe no error

Expected behavior

props should be inferred to have type CounterProps and args and argTypes should show typescript errors for incorrect properties.

Screenshots and/or logs

Actual:

image

Expected:

Unsaved Image 1

If applicable, add screenshots and/or logs to help explain your problem.

Environment

Additional context

Add any other context about the problem here.