You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The newest @wordpress/data version 8.4.0 does not work with Typescript.
This error does not occur when switching to 8.3.x in package.json. It seems that the select() (and also dispatch()) function do not have the correct Typescript types / return types / docblock types and therfor Typescript parsing fails. It actually already fails in the IDE (PHPStorm) due "underlining" the code with notice: TS2339: Property 'getCurrentPostType' does not exist on type 'Object'.
When building assets it fails due following errors (my example code - see below):
> yarn build
yarn run v1.22.15
warning package.json: No license field
$ wp-scripts build
assets by status 396 bytes [cached] 2 assets
Entrypoint test = test.js test.asset.php
./test.ts 258 bytes [built] [code generated] [2 errors]
external ["wp","data"] 42 bytes [built] [code generated]
ERROR in .\wordpress-data-8.4\test.ts
./test.ts 4:37-55
[tsl] ERROR in .\wordpress-data-8.4\test.ts(4,38)
TS2339: Property 'getCurrentPostType' does not exist on type 'Object'.
ts-loader-default_e3b0c44298fc1c14
ERROR in .\wordpress-data-8.4\test.ts
./test.ts 5:48-57
[tsl] ERROR in .\wordpress-data-8.4\test.ts(5,49)
TS2339: Property 'getBlocks' does not exist on type 'Object'.
ts-loader-default_e3b0c44298fc1c14
ERROR in .\test-wordpress-data-8.4\test.ts
./test.ts 6:32-43
[tsl] ERROR in .\test-wordpress-data-8.4\test.ts(6,33)
TS2339: Property 'resetBlocks' does not exist on type 'Object'.
webpack 5.75.0 compiled with 2 errors in 3117 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Step-by-step reproduction instructions
1. Create a new folder and insert following package.json:
Description
The newest
@wordpress/data
version 8.4.0 does not work with Typescript.This error does not occur when switching to
8.3.x
inpackage.json
. It seems that theselect()
(and alsodispatch()
) function do not have the correct Typescript types / return types / docblock types and therfor Typescript parsing fails. It actually already fails in the IDE (PHPStorm) due "underlining" the code with notice:TS2339: Property 'getCurrentPostType' does not exist on type 'Object'.
When building assets it fails due following errors (my example code - see below):
Step-by-step reproduction instructions
1. Create a new folder and insert following
package.json
:2. Create a
tsconfig.json
:3. Create a
webpack.config.js
:4. Create a
test.ts
5. run
yarn build
It fails - see error above.
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: