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

[Bug]: Cannot find name 'PromiseWithResolvers' #28527

Closed
jlowcs opened this issue Jul 10, 2024 · 7 comments · Fixed by #28548
Closed

[Bug]: Cannot find name 'PromiseWithResolvers' #28527

jlowcs opened this issue Jul 10, 2024 · 7 comments · Fixed by #28548

Comments

@jlowcs
Copy link

jlowcs commented Jul 10, 2024

Describe the bug

A reference to PromiseWithResolvers was introduced by #28383

That type is not imported anywhere in that file and my library (using react) doesn't compile because of it.

Reproduction link

N/A

Reproduction steps

No response

System

Storybook Environment Info:

  System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - ~/.nvm/versions/node/v20.11.0/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v20.11.0/bin/npm <----- active
  Browsers:
    Chrome: 126.0.6478.127
    Firefox: 128.0
    Safari: 17.5
  npmPackages:
    @storybook/addon-a11y: ^8.2.1 => 8.2.1 
    @storybook/addon-actions: ^8.2.1 => 8.2.1 
    @storybook/addon-docs: ^8.2.1 => 8.2.1 
    @storybook/addon-essentials: ^8.2.1 => 8.2.1 
    @storybook/addon-interactions: ^8.2.1 => 8.2.1 
    @storybook/addon-links: ^8.2.1 => 8.2.1 
    @storybook/addon-webpack5-compiler-swc: ^1.0.4 => 1.0.4 
    @storybook/cli: ^8.2.1 => 8.2.1 
    @storybook/components: ^8.2.1 => 8.2.1 
    @storybook/manager-api: ^8.2.1 => 8.2.1 
    @storybook/node-logger: ^8.2.1 => 8.2.1 
    @storybook/react: ^8.2.1 => 8.2.1 
    @storybook/react-webpack5: ^8.2.1 => 8.2.1 
    @storybook/testing-library: ^0.2.2 => 0.2.2 
    @storybook/theming: ^8.2.1 => 8.2.1 
    storybook: ^8.1.11 => 8.2.1

Additional context

No response

Copy link
Contributor

greptile-apps bot commented Jul 10, 2024

To resolve the issue, import PromiseWithResolvers at the top of portable-stories.ts. Add the following line:

import { PromiseWithResolvers } from '@storybook/core/types';

This should be placed alongside other imports from @storybook/core/types.

References

/code/core/src/preview-api/modules/store/csf/portable-stories.ts
/code/core/src/preview-api/modules/store/csf

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@valpioner
Copy link

Having the same issue with 8.2.1 during a regular build for our angular library (ng run my-project:storybook)
TS2304: Cannot find name 'PromiseWithResolvers'.

Node version: v20.15.0
TypeScript 5.4.5

image
image

@bertheto
Copy link

bertheto commented Jul 11, 2024

Hello I have the same issue on my side with the 8.2.1...

node_modules/@storybook/core/dist/preview-api/index.d.ts:349:22 - error TS2304: Cannot find name 'PromiseWithResolvers'.

349     renderingEnded?: PromiseWithResolvers<void>;
                         ~~~~~~~~~~~~~~~~~~~~

=> Failed to build the preview
SB_BUILDER-WEBPACK5_0003 (WebpackCompilationError): There were problems when compiling your code with Webpack.
Run Storybook with --debug-webpack for more information.

"devDependencies": {
"@angular-devkit/architect": "^0.1700.0",
"@angular-devkit/build-angular": "^17.0.0",
"@angular-eslint/builder": "17.5.2",
"@angular-eslint/eslint-plugin": "17.5.2",
"@angular-eslint/eslint-plugin-template": "17.5.2",
"@angular-eslint/schematics": "17.5.2",
"@angular-eslint/template-parser": "17.5.2",
"@angular/cli": "^17.0.0",
"@angular/compiler-cli": "^17.0.0",
"@chromatic-com/storybook": "^1.6.1",
"@compodoc/compodoc": "^1.1.25",
"@eslint/js": "^9.4.0",
"@etchteam/storybook-addon-status": "^5.0.0",
"@kemuridama/storybook-addon-github": "^1.3.0",
"@storybook/addon-a11y": "8.2.1",
"@storybook/addon-console": "^3.0.0",
"@storybook/addon-designs": "^8.0.3",
"@storybook/addon-docs": "8.2.1",
"@storybook/addon-essentials": "8.2.1",
"@storybook/addon-interactions": "8.2.1",
"@storybook/addon-links": "8.2.1",
"@storybook/addon-storysource": "8.2.1",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/angular": "8.2.1",
"@storybook/blocks": "8.2.1",
"@storybook/test": "8.2.1",
"@storybook/test-runner": "^0.19.0",
"@types/cheerio": "^0.22.31",
"@types/jasmine": "~4.3.0",
"@types/jasminewd2": "^2.0.10",
"@types/jest": "^29.5.1",
"@types/lodash": "^4.14.194",
"@types/node": "^20.2.3",
"@typescript-eslint/eslint-plugin": "7.11.0",
"@typescript-eslint/parser": "7.11.0",
"@whitespace/storybook-addon-html": "^6.1.1",
"cheerio": "^1.0.0-rc.12",
"chromatic": "^11.5.4",
"eslint": "^9.4.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "~48.2.9",
"eslint-plugin-prefer-arrow": "1.2.3",
"eslint-plugin-storybook": "^0.9.0--canary.0",
"gh-pages": "^6.1.1",
"globals": "^15.4.0",
"husky": "^8.0.0",
"jasmine-core": "~4.5.0",
"jasmine-spec-reporter": "~7.0.0",
"json-server": "^0.17.3",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"karma-coverage-istanbul-reporter": "^3.0.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"msw": "^2.3.1",
"msw-storybook-addon": "^2.0.2",
"ngx-build-plus": "^14.0.0",
"prettier": "^3.3.2",
"react-syntax-highlighter": "^15.5.0",
"storybook": "8.2.1",
"ts-node": "^10.9.1",
"tslib": "^2.5.2",
"typescript": "~5.4.5",
"typescript-eslint": "^7.13.0",
"webpack": "5.92.0",

@bertheto
Copy link

bertheto commented Jul 11, 2024

Even if I come back to the 8.1.11 Story book version, it is still the v8.2.x @storybook/preview-api version wich is installed by NPM ... and in my node module, there is no dist folder regarding this version.
To have a functionnal 8.1.11 version I have to install manually the preview-api like this : npm i @storybook/preview-api@8.1.11

@valentinpalkovic
Copy link
Contributor

@kasperpeulen is working on a fix. We will try to release a hotfix soon!

@bertheto
Copy link

@kasperpeulen is working on a fix. We will try to release a hotfix soon!

Great ! thank you in advance !

@matijs
Copy link

matijs commented Jul 12, 2024

Adding "ESNext" to "lib" in tsconfig.json works but I'm not sure that's feasible for everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants