Skip to content

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

Open
@olivercoad

Description

@olivercoad

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 (elite174/storybook-solid-js@b4eee6a 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

  • OS: linux64
  • Node.js version: 21.6.2
  • YARN version: 4.1.1
  • Browser (if applicable):
  • Browser version (if applicable):
  • Device (if applicable):

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions