Storybook: @storybook/angular & @storybook/addons require node types

Created on 8 Oct 2019  路  15Comments  路  Source: storybookjs/storybook

Can't find it in the source code, but the published @storybook/angular & @storybook/addons version 5.2.3 types require node types:

image
image

That conflicts with client code, e.g. we see lots of:

Error:(10, 9) TS2322: Type 'Timeout' is not assignable to type 'number'.

Because the node.js setTimeout definition returns Timeout and the dom implementation returns number. Is that reference to node.js really required? Given that much of the code also runs in the browser, node.js types are kind of misleading anyway.

question / support typescript

All 15 comments

The workaround I use right now is setting this in tsconfig.json compilerOptions:

        "typeRoots": [
            "@types",
            "../node_modules/@types"
        ]

and create an empty @types/node/index.d.ts file. When typescript tries to resolve the /// <reference types="node" />, it'll grab the empty definition instead of the one installed in node_modules/@types.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

This is a pretty important one, it just bit us as well.

The client and server code of app/angular shares the same tsconfig with types: ['node']

Maybe we can use the tripple-slash reference directly where they are needed and remove node from the tsconfig 馃
Hopefully the same works for @storybook/addon

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Still an issue.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Still an issue, unless it's been addressed? Someone is assigned to it. It's probably not a tough issue to address.

@aaronjensen do you want to take a crack at this?

Maybe @gaetanmaisse knows how to solve this?

I think I have a fix. Will submit soon.

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

This was fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wahengchang picture wahengchang  路  3Comments

miljan-aleksic picture miljan-aleksic  路  3Comments

Jonovono picture Jonovono  路  3Comments

alexanbj picture alexanbj  路  3Comments

ZigGreen picture ZigGreen  路  3Comments