Storybook: [storybook/angular] Incompatible dependency with TypeScript 4.0

Created on 22 Oct 2020  路  6Comments  路  Source: storybookjs/storybook

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.

P1 angular dependencies maintenance typescript

Most helpful comment

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

All 6 comments

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

@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?

@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.

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

Do you mind making a small PR to fix it?

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
Was this page helpful?
0 / 5 - 0 ratings