-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
When attempting to compile TypeScript code like this:
import { store as coreStore } from '@wordpress/core-data';
import { createRegistrySelector } from '@wordpress/data';
createRegistrySelector( select => () => {
const { getSite } = select( coreStore );
} );using @wordpress/core-data 7.14.0 and @wordpress/data 10.14.0, tsc gives an error
index.ts:5:13 - error TS2339: Property 'getSite' does not exist on type '{ getAuthors: (query?: { [x: string]: any; }) => User<"edit">[]; getCurrentUser: () => User<"edit">; getEntitiesByKind: (kind: string) => any[]; getEntity: (kind: string, name: string) => any; ... 45 more ...; getRevision: any; }'.
5 const { getSite } = select( coreStore );
~~~~~~~
Found 1 error in index.ts:5
Digging into it a bit, with reference to this code
gutenberg/packages/core-data/src/index.js
Lines 69 to 74 in bf2be67
| const storeConfig = () => ( { | |
| reducer, | |
| actions: { ...actions, ...entityActions, ...createLocksActions() }, | |
| selectors: { ...selectors, ...entitySelectors }, | |
| resolvers: { ...resolvers, ...entityResolvers }, | |
| } ); |
it seems the typing for the store in
node_modules/@wordpress/core-data/build-types/index.d.ts reflects only the selectors from selectors, all those from entitySelectors are missing.Metadata
Metadata
Assignees
Labels
No labels