Skip to content

TypeScript: meta on all the core object types is wrongly set as a record of strings #70786

@manzoorwanijk

Description

@manzoorwanijk

Description

The meta object for Post, Comment, User etc. can be anything, and not just a record of strings as depicted by current types

If the meta for a core type is an object, TS isn't happy about it.

Image

Step-by-step reproduction instructions

Use this snippet in some TypeScript file

useSelect( select => {
	const { meta } = select( coreStore ).getEntityRecord< Post >( 'postType', 'post', 123 );

	return meta.some_object.test;
}, [] );

Notice the error when reading the test property

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

Assignees

Labels

[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended[Type] Code QualityIssues or PRs that relate to code quality

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions