#58671 closed defect (bug) (worksforme)
"error TS2315: Type 'Server' is not generic" when building Gutenberg from WP checkout
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 6.3 |
Component: | Build/Test Tools | Keywords: | |
Focuses: | Cc: |
Description
Discovered in a coding session with @afercia and @aristath.
Steps to reproduce:
- Have a Gutenberg repo checkout in the plugins directory of a WordPress core checkout:
wordpress-develop/build/wp-content/plugins/gutenberg/
- Attempt to build Gutenberg from that directory:
npm run build
- At some point the process fails with a few errors:
> gutenberg@16.0.0 build:packages .../wordpress-develop/build/wp-content/plugins/gutenberg > npm run build:package-types && node ./bin/packages/build.js > gutenberg@16.0.0 build:package-types .../wordpress-develop/build/wp-content/plugins/gutenberg > node ./bin/packages/validate-typescript-version.js && tsc --build && node ./bin/packages/check-build-type-declaration-files.js Incorrect published types for .../wordpress-develop/build/wp-content/plugins/gutenberg/packages/core-data/build-types/index.d.ts: .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,18): error TS2315: Type 'Server' is not generic. .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,34): error TS2315: Type 'Server' is not generic. Incorrect published types for .../wordpress-develop/build/wp-content/plugins/gutenberg/packages/data/build-types/index.d.ts: .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,18): error TS2315: Type 'Server' is not generic. .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,34): error TS2315: Type 'Server' is not generic. Incorrect published types for .../wordpress-develop/build/wp-content/plugins/gutenberg/packages/e2e-test-utils-playwright/build-types/index.d.ts: .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,18): error TS2315: Type 'Server' is not generic. .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,34): error TS2315: Type 'Server' is not generic. Incorrect published types for .../wordpress-develop/build/wp-content/plugins/gutenberg/packages/notices/build-types/index.d.ts: .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,18): error TS2315: Type 'Server' is not generic. .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,34): error TS2315: Type 'Server' is not generic. Incorrect published types for .../wordpress-develop/build/wp-content/plugins/gutenberg/packages/rich-text/build-types/index.d.ts: .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,18): error TS2315: Type 'Server' is not generic. .../wordpress-develop/node_modules/@types/ws/index.d.ts(328,34): error TS2315: Type 'Server' is not generic.
Note that @types/ws/index.d.ts
is used not from the Gutenberg directory, but from the WordPress core checkout.
This appears to be introduced in [56065], where the @types/ws
package was updated from version 8.5.4 to 8.5.5. Though the package is not used directly by core or Gutenberg, it is used as a dependency of some other packages.
A recent Stack Overflow thread with a similar error suggests reverting @types/ws
to 8.5.4 as a workaround:
npm i @types/ws@8.5.4
That indeed allows the build to complete successfully.
There appears to be a related PR with the fix upstream, however it is not merged yet.
This ticket is mostly for tracking purposes. In case anyone else encounters the issue, it might be worth locking @types/ws
to version 8.5.4 in core for now.
Change History (5)
#3
follow-up:
↓ 4
@
7 weeks ago
- Keywords close reporter-feedback added
I've spent a good chunk of time working on #59632 today. This was in an effort to avoid reintroduction of #59634. But I also tested for this issue in the process.
I was unable to reproduce this one both locally and within the workflow with the changes being proposed in the PR attached to #59632. I'm wondering if this was fixed, either by the upstream change linked in the ticket (though the specific PR was closed in favor of the author creating a new one) or in Gutenberg itself.
@SergeyBiryukov @aristath, @afercia could you confirm whether this problem is still occurring for you? And if it is, could you take a look at the steps being performed within the PR to try and identify which test case is missing?
Marking as close
candidate since it works-for-me
, but can leave open to explore further if there's something I'm missing.
#4
in reply to:
↑ 3
@
7 weeks ago
- Keywords close reporter-feedback removed
- Milestone 6.4 deleted
- Resolution set to worksforme
- Status changed from new to closed
Replying to desrosj:
could you confirm whether this problem is still occurring for you?
Thanks for the ping! This appears to be resolved in our testing.
Moving to milestone 6.4 as WP 6.3 RC3 has been released.