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

Enable useSelect autocompletion #41911

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,6 @@ _Related_

- <https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore>

_Type_

- `Object`

### storeConfig

Block editor data store configuration.
Expand All @@ -633,10 +629,6 @@ _Related_

- <https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore>

_Type_

- `Object`

### ToolSelector

Undocumented declaration.
Expand Down
4 changes: 0 additions & 4 deletions packages/block-editor/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { STORE_NAME } from './constants';
* Block editor data store configuration.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore
*
* @type {Object}
*/
export const storeConfig = {
reducer,
Expand All @@ -28,8 +26,6 @@ export const storeConfig = {
* Store definition for the block editor namespace.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
*
* @type {Object}
*/
export const store = createReduxStore( STORE_NAME, {
...storeConfig,
Expand Down
3 changes: 2 additions & 1 deletion packages/block-editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"references": [
{ "path": "../deprecated" },
{ "path": "../element" },
{ "path": "../hooks" }
{ "path": "../hooks" },
{ "path": "../data" }
],
// NOTE: This package is being progressively typed. You are encouraged to
// expand this array with files which can be type-checked. At some point in
Expand Down
5 changes: 3 additions & 2 deletions packages/compose/src/hooks/use-dialog/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import useFocusReturn from '../use-focus-return';
import useFocusOutside from '../use-focus-outside';
import useMergeRefs from '../use-merge-refs';

/* eslint-disable jsdoc/valid-types */
/**
* @typedef {import('../use-focus-on-mount').default} useFocusOnMount
*/
/**
* @typedef DialogOptions
* @property {Parameters<useFocusOnMount>[0]} focusOnMount Focus on mount arguments.
* @property {() => void} onClose Function to call when the dialog is closed.
*/
/* eslint-enable jsdoc/valid-types */

/**
* Returns a ref and props to apply to a dialog wrapper to enable the following behaviors:
Expand Down
6 changes: 4 additions & 2 deletions packages/data/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"rootDir": "src",
"declarationDir": "build-types",
"noUnusedParameters": false
"noUnusedParameters": false,
"checkJs": false
},
"references": [
{ "path": "../compose" },
Expand All @@ -17,6 +18,7 @@
"src/redux-store/metadata/**/*",
"src/promise-middleware.js",
"src/utils",
"src/*.ts"
"src/*.ts",
"src/**/*.js"
]
}
3 changes: 3 additions & 0 deletions typings/wordpress__data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module '@wordpress/data' {
export * from '@wordpress/data/build-types/index';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this play with the issue of having a global DefinitelyTyped package in for @wordpress/data?

Copy link
Contributor Author

@adamziel adamziel Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overrides the DefinitelyTyped types thanks to the "typeRoots": [ "./typings", "./node_modules/@types" ], setting in tsconfig.json.

}