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
Storybook controls TypeScript inference not working as expected in a NX workspace #17388
Comments
After digging through a bunch of code to try and locate the issue following the logic through all kinds of places I finally have the actual root cause for this issue. To start with: This is 100% an issue because of the NX configuration. That said I likely need to move this issue over to https://github.com/nrwl/nx That said I will put my findings here to help anyone that may come to this repo in search of the solution to this problem in the future. What is occuring is
|
cc @mandarini |
Hi there @rmevans9 ! Have you opened an issue on the Nx github page? If yes, can you give me the link? Thanks for looking into this! :) |
Hello @mandarini, I never did create an issue over there because I solved it for myself with the config and then quickly got distracted on other things I had to get done.. sorry about that! I did note one extra thing after closing this issue, there is actually a tsconfig in the |
Potentially. Can you share a repo I could take a look at? tsconfig in |
@mandarini there is one linked in the original ticket that shows the behavior |
Describe the bug
When a component refers to a type from another lib in a NX workspace via the alias created by NX storybook controls fail to infer the type correctly.
To Reproduce
This reproduction was setup via NX CLI commands since the behavior is exhibited that way.
Repo: https://github.com/rmevans9/storybook-ts-issue
Storybook: https://main--61f9e6cee45291003a1e5539.chromatic.com/
System
Please paste the results of
npx sb@next info
here.Environment Info:
Additional context
I suspect it has something to do with just the alias setup that NX uses because as you see in the reproduction case (https://github.com/rmevans9/storybook-ts-issue/blob/main/libs/storybook/src/lib/TestComponent.tsx#L2-L13) I import the exact same type from the same file and it has different outcomes. The only difference is direct path import vs the alias import.
Also note that all of the properties defined have effectively the same type as far as TypeScript is concerned
The text was updated successfully, but these errors were encountered: