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

Type errors in @wordpress/data #46626

Closed
marekdedic opened this issue Dec 16, 2022 · 0 comments · Fixed by #46881 or #48221
Closed

Type errors in @wordpress/data #46626

marekdedic opened this issue Dec 16, 2022 · 0 comments · Fixed by #46881 or #48221
Assignees
Labels
Developer Experience Ideas about improving block and theme developer experience [Package] Data /packages/data [Type] Code Quality Issues or PRs that relate to code quality

Comments

@marekdedic
Copy link
Contributor

Description

Hi,
I'm trying to use the types bundled with @wordpress/data in order to remove the @types/wordpress__data typings package. However, I am running into some problems with the types themselves - I get the following errors:

node_modules/@wordpress/data/build-types/components/use-dispatch/use-dispatch.d.ts(2,82): error TS2344: Type 'StoreConfig' does not satisfy the constraint 'AnyConfig'.
node_modules/@wordpress/data/build-types/components/use-select/index.d.ts(95,72): error TS2344: Type 'C' does not satisfy the constraint 'AnyConfig'.
node_modules/@wordpress/data/build-types/components/use-select/index.d.ts(96,105): error TS2344: Type 'Actions' does not satisfy the constraint 'MapOf<ActionCreator>'.
node_modules/@wordpress/data/build-types/components/use-select/index.d.ts(97,72): error TS2344: Type 'T' does not satisfy the constraint 'MapSelect | StoreDescriptor<any>'.
  Type 'T' is not assignable to type 'StoreDescriptor<any>'.
node_modules/@wordpress/data/build-types/redux-store/index.d.ts(25,134): error TS2344: Type 'Actions' does not satisfy the constraint 'MapOf<ActionCreator>'.
node_modules/@wordpress/data/build-types/redux-store/index.d.ts(25,234): error TS2344: Type 'Actions' does not satisfy the constraint 'MapOf<ActionCreator>'.
node_modules/@wordpress/data/build-types/redux-store/index.d.ts(27,69): error TS2344: Type 'C' does not satisfy the constraint 'AnyConfig'.
node_modules/@wordpress/data/build-types/redux-store/index.d.ts(28,102): error TS2344: Type 'Actions' does not satisfy the constraint 'MapOf<ActionCreator>'.

Looking at them manually, the reported issues seem correct...

Step-by-step reproduction instructions

  1. Check out https://github.com/marekdedic/DefinitelyTyped/tree/wordpress__rich-text-upstream-data
  2. Delete the types/wordpress__data directory to force use of types in @wordpress/data
  3. Run npm test wordpress__rich-text

Screenshots, screen recording, code snippet

No response

Environment info

  • @wordpress/data 8.0.0

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

@gziolo gziolo added [Package] Data /packages/data [Type] Code Quality Issues or PRs that relate to code quality Developer Experience Ideas about improving block and theme developer experience labels Dec 17, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Jan 4, 2023
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Experience Ideas about improving block and theme developer experience [Package] Data /packages/data [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
3 participants