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

[storybook/angular] Incompatible dependency with TypeScript 4.0 #12859

Closed
lacolaco opened this issue Oct 22, 2020 · 6 comments · Fixed by #12866
Closed

[storybook/angular] Incompatible dependency with TypeScript 4.0 #12859

lacolaco opened this issue Oct 22, 2020 · 6 comments · Fixed by #12866
Labels

Comments

@lacolaco
Copy link

Describe the bug

In the package.json of @storybook/angular, typescript peer dependency version is pinned as ^3.4.0 so it works until Angular v10 and TS3.9.

Since Angualr v11 (RC has began), TS4.0 is only supported. ng update command try to update TypeScript to 4.0 but version conflict happens.

Package "@storybook/angular" has an incompatible peer dependency to "typescript" (requires "^3.4.0", would install "4.0.3").

In fact, TypeScript is not following Semver convention. Pinning version with ^ doesn't make sense.

Expected behavior

Angular (@angular-devkit/build-angular) has its own peer dependency for TypeScript so I think Storybook don't have to depend on it by itself again.

@lacolaco lacolaco changed the title [storybook/angular] Cannot use with Angular v11 due to TypeScript 4.0 [storybook/angular] Incompatible dependency with TypeScript 4.0 Oct 22, 2020
@shilman
Copy link
Member

shilman commented Oct 22, 2020

Does TS4.0 work with older versions of angular? Can we just change the version specifier to be >=3.4.0 or something?

@shilman shilman added the maintenance User-facing maintenance tasks label Oct 22, 2020
@lacolaco
Copy link
Author

@shilman Current stable version of Angular (v10.1) supports TS3.9 or 4.0. And v11.0 only supports TS4.0.

I think, Storybook only needs to have peer dependency range for Angular family. It can restrict minimum Angular version instead of minimum TypeScript version. If developers use @storybook/angular, it means they use Angular, and Angular depends on proper version of TypeScript.
Are there reasons to determine TS version in @storybook/angular?

@shilman
Copy link
Member

shilman commented Oct 22, 2020

@storybook/angular uses ts-loader which in turn uses typescript. Since Angular already uses typescript we just want to use whatever version angular supports. However, we use features that are only available in 3.4 and above. It looks like we're currently supporting back to Angular 6.

@lacolaco
Copy link
Author

I see, thank you for explaining. So, as you said I think >=3.4.0 is better version range in this case.

@shilman
Copy link
Member

shilman commented Oct 22, 2020

Do you mind making a small PR to fix it?

twerske added a commit to twerske/storybook that referenced this issue Oct 22, 2020
…port Angula7

With the release of Angular v11-rc.0, TypeScript 4.0 must be supported in order to `ng update`. Updating the peerDep to `>=3.4.0` allows `@storybook/angular` to be compatible back to Angular 6.  This resolves issue storybookjs#12859
twerske added a commit to twerske/storybook that referenced this issue Oct 22, 2020
`@storybook/angular` should be compatible with Angular 11 which requires TypeScript 4.0
This resolves storybookjs#12859 by supporting any version above Angular 6 through the latest RC
twerske added a commit to twerske/storybook that referenced this issue Oct 22, 2020
`@storybook/angular` should be compatible with Angular 11 which requires TypeScript 4.0
This resolves storybookjs#12859 by supporting any version above Angular 6 through the latest RC
@shilman
Copy link
Member

shilman commented Oct 23, 2020

Yippee!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-alpha.28 containing PR #12866 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

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