diff --git a/components/post-title/index.js b/components/post-title/index.tsx similarity index 63% rename from components/post-title/index.js rename to components/post-title/index.tsx index 3db54ad6..f764eeb4 100644 --- a/components/post-title/index.js +++ b/components/post-title/index.tsx @@ -1,11 +1,18 @@ import { useEntityProp } from '@wordpress/core-data'; import { RichText, store as blockEditorStore } from '@wordpress/block-editor'; import { useSelect } from '@wordpress/data'; -import PropTypes from 'prop-types'; import { usePost } from '../../hooks'; -export const PostTitle = (props) => { - const { tagName: TagName = 'h1', ...rest } = props; +interface PostTitleProps { + tagName?: TElementType | keyof JSX.IntrinsicElements; +} + +type PostTitlePropsWithOmit = PostTitleProps & Omit, keyof PostTitleProps>; + +export const PostTitle = ({ + tagName: TagName = 'h1', + ...rest +}: PostTitlePropsWithOmit ) => { const { postId, postType, isEditable } = usePost(); const [rawTitle = '', setTitle, fullTitle] = useEntityProp( @@ -36,11 +43,3 @@ export const PostTitle = (props) => { /> ); }; - -PostTitle.propTypes = { - tagName: PropTypes.string, -}; - -PostTitle.defaultProps = { - tagName: 'h1', -};