Skip to content

Commit

Permalink
Components: Add types to Shortcut (WordPress#29633)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend authored Mar 8, 2021
1 parent 398a9e7 commit 00ae3fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/components/src/shortcut/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
*/
import { isString, isObject } from 'lodash';

/** @typedef {string | { display: string, ariaLabel: string }} Shortcut */
/**
* @typedef Props
* @property {Shortcut} shortcut Shortcut configuration
* @property {string} [className] Classname
*/

/**
* @param {Props} props Props
* @return {JSX.Element | null} Element
*/
function Shortcut( { shortcut, className } ) {
if ( ! shortcut ) {
return null;
Expand Down
1 change: 1 addition & 0 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"src/dashicon/**/*",
"src/flex/**/*",
"src/form-group/**/*",
"src/shortcut/**/*",
"src/spinner/**/*",
"src/tip/**/*",
"src/ui/**/*",
Expand Down

0 comments on commit 00ae3fc

Please sign in to comment.