Enhanced TypeScript support in WordPress 6.1

WordPress 6.1 enhances the TypeScript support for the frontend data stores. The types it ships for the @wordpress/data and @wordpress/core-data npm packages enable auto-completion and improvements in static type checks. As a recap, @wordpress/data is the foundational package powering all the data stores in the WordPress editor. WordPress 6.1 provides the TypeScript signatures for its central utilities: createReduxStore, and useSelect, ensuring the selector types are correctly reflected in the code that uses them: import { createReduxStore, useSelect, useDispatch } from ‘@wordpress/data’; const config = { reducer: () => null, selectors: { /** * @param {Object} state * @param {string} unit

source https://www.worldofwp.com/enhanced-typescript-support-in-wordpress-6-1/

Comments

Popular posts from this blog