diff --git a/components/author/index.tsx b/components/author/index.tsx index e55905ff..9a83f2f9 100644 --- a/components/author/index.tsx +++ b/components/author/index.tsx @@ -44,8 +44,9 @@ export const LastName: React.FC = (props) => { return {lastName}; }; -function useDefaultAvatar() { +function useDefaultAvatar(): string { const { avatarURL: defaultAvatarUrl } = useSelect((select) => { + // @ts-ignore-next-line The type definitions for the block editor store are incomplete. const { getSettings } = select(blockEditorStore); const { __experimentalDiscussionSettings } = getSettings(); return __experimentalDiscussionSettings; diff --git a/components/clipboard-button/index.tsx b/components/clipboard-button/index.tsx index 826fe860..14d8208e 100644 --- a/components/clipboard-button/index.tsx +++ b/components/clipboard-button/index.tsx @@ -48,7 +48,7 @@ export const ClipboardButton: React.FC = ({ const copied = labels.copied ? labels.copied : __('Copied'); useEffect(() => { - let timerId: undefined | number; + let timerId: ReturnType; if (hasCopied) { timerId = setTimeout(() => { diff --git a/components/color-settings/index.tsx b/components/color-settings/index.tsx index 1da2959b..27658097 100644 --- a/components/color-settings/index.tsx +++ b/components/color-settings/index.tsx @@ -49,7 +49,7 @@ interface ColorSettingProps { /** * Callback called when a color is selected. */ - onChange: Function; + onChange: (color: string) => void; } interface Color { diff --git a/components/custom-block-appender/index.js b/components/custom-block-appender/index.tsx similarity index 50% rename from components/custom-block-appender/index.js rename to components/custom-block-appender/index.tsx index 4b1645bb..57059fce 100644 --- a/components/custom-block-appender/index.js +++ b/components/custom-block-appender/index.tsx @@ -1,20 +1,22 @@ import { Inserter } from '@wordpress/block-editor'; -import { Button } from '@wordpress/components'; +import { Button, IconType } from '@wordpress/components'; +import { FC } from 'react'; -/** +interface CustomBlockAppenderProps { + rootClientId: string; + className?: string; + buttonText?: string; + icon?: IconType; + [key: string]: any; // For additional props spread onto the Button component +} + +/* * CustomBlockAppender. * * Provide a Button component to trigger the inserter. * Any undocumented props are spread onto the Button component. - * - * @param {object} props All props sent to this component. - * @param {string} props.rootClientId Client ID of the block where this is being used. - * @param {string} props.className class names to be added to the button. - * @param {string} [props.buttonText] Text to display in the Button. - * @param {string} [props.icon] The icon to use. - * @returns {Function} The component. */ -const CustomBlockAppender = ({ +export const CustomBlockAppender: FC = ({ rootClientId, buttonText = '', icon = 'plus', @@ -25,7 +27,13 @@ const CustomBlockAppender = ({ ( + renderToggle={({ + onToggle, + disabled, + }: { + onToggle: () => void; + disabled?: boolean; + }) => (