Skip to content

@wordpress/data typedefs aren't resolved properly under Node16 #73264

@joshualip-plaudit

Description

@joshualip-plaudit

Description

This is a repeat of #72806, albeit in the @wordpress/data package this time.

import meta types for the creation of and working with Redux stores from "@wordpress/data" used to work when using the Node16 resolution mode in TypeScript. It (tsc) now cannot resolve the types.
The source of the issue is the addition of the exports field in it's package.json file in f064f92

Unfortunately, the solution to the problem isn't as simple as it was for #72806, so my proposed additions to the package.json file are a bit messier.

I'll have a PR that makes that change up shortly
PR is here: #73265

Step-by-step reproduction instructions

  1. Add the import like import type {ActionCreator, ReduxStoreConfig} from "@wordpress/data/build-types/types"; to a typescript file in a project using Node16 moduleResolution
    • Prior to the addition of the exports field, this would have worked
  2. Try to build it

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure

Metadata

Metadata

Labels

[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions