diff --git a/app/components/AuthenticatedLayout.tsx b/app/components/AuthenticatedLayout.tsx index 64fb2ddf99..695ed4c136 100644 --- a/app/components/AuthenticatedLayout.tsx +++ b/app/components/AuthenticatedLayout.tsx @@ -113,11 +113,12 @@ const AuthenticatedLayout: React.FC> = ({ !!team.getPreference(TeamPreference.Commenting); const sidebarRight = ( + // @ts-expect-error - framer-motion v4 has TypeScript compatibility issues with React 18 - {(showHistory || showInsights || showComments) && ( + {showHistory || showInsights || showComments ? ( @@ -127,7 +128,7 @@ const AuthenticatedLayout: React.FC> = ({ - )} + ) : null} ); diff --git a/app/components/Collaborators.tsx b/app/components/Collaborators.tsx index 599bd7177b..b4a7d9e267 100644 --- a/app/components/Collaborators.tsx +++ b/app/components/Collaborators.tsx @@ -132,7 +132,7 @@ function Collaborators(props: Props) { ); const renderAvatar = useCallback( - ({ model: collaborator, ...rest }) => { + ({ model: collaborator, ...rest }: any) => { const isPresent = presentIds.has(collaborator.id); const isEditing = editingIds.has(collaborator.id); const isObserving = observingUserId === collaborator.id; diff --git a/app/components/ContextMenu/MenuItem.tsx b/app/components/ContextMenu/MenuItem.tsx index c31b6bea3a..0c41c92d83 100644 --- a/app/components/ContextMenu/MenuItem.tsx +++ b/app/components/ContextMenu/MenuItem.tsx @@ -45,7 +45,7 @@ const MenuItem = ( ref: React.Ref ) => { const content = React.useCallback( - (props) => { + (props: any) => { // Preventing default mousedown otherwise menu items do not work in Firefox, // which triggers the hideOnClickOutside handler first via mousedown – hiding // and un-rendering the menu contents. diff --git a/app/components/DocumentCard.tsx b/app/components/DocumentCard.tsx index db2d938d58..df966d1ee2 100644 --- a/app/components/DocumentCard.tsx +++ b/app/components/DocumentCard.tsx @@ -64,7 +64,7 @@ function DocumentCard(props: Props) { }; const handleUnpin = useCallback( - async (ev) => { + async (ev: any) => { ev.preventDefault(); ev.stopPropagation(); await pin?.delete(); diff --git a/app/components/EditableTitle.tsx b/app/components/EditableTitle.tsx index aa487c728f..9e50342552 100644 --- a/app/components/EditableTitle.tsx +++ b/app/components/EditableTitle.tsx @@ -41,27 +41,27 @@ function EditableTitle( setValue(title); }, [title]); - const handleChange = React.useCallback((event) => { + const handleChange = React.useCallback((event: any) => { setValue(event.target.value); }, []); - const handleDoubleClick = React.useCallback((event) => { + const handleDoubleClick = React.useCallback((event: any) => { event.preventDefault(); event.stopPropagation(); setIsEditing(true); }, []); - const stopPropagation = React.useCallback((event) => { + const stopPropagation = React.useCallback((event: any) => { event.preventDefault(); event.stopPropagation(); }, []); - const handleFocus = React.useCallback((event) => { + const handleFocus = React.useCallback((event: any) => { event.target.select(); }, []); const handleSave = React.useCallback( - async (ev) => { + async (ev: any) => { ev.preventDefault(); ev.stopPropagation(); @@ -89,7 +89,7 @@ function EditableTitle( ); const handleKeyDown = React.useCallback( - async (ev) => { + async (ev: any) => { if (ev.nativeEvent.isComposing) { return; } diff --git a/app/components/Editor.tsx b/app/components/Editor.tsx index e41ef39a51..97176529aa 100644 --- a/app/components/Editor.tsx +++ b/app/components/Editor.tsx @@ -169,7 +169,7 @@ function Editor(props: Props, ref: React.RefObject | null) { }, [onCreateCommentMark, onDeleteCommentMark, comments.orderedData]); const handleChange = React.useCallback( - (event) => { + (event: any) => { onChange?.(event); updateComments(); }, diff --git a/app/components/FilterOptions.tsx b/app/components/FilterOptions.tsx index d621c0710f..b611a61fc5 100644 --- a/app/components/FilterOptions.tsx +++ b/app/components/FilterOptions.tsx @@ -57,7 +57,7 @@ const FilterOptions = ({ : ""; const renderItem = React.useCallback( - (option) => ( + (option: any) => ( { diff --git a/app/components/IconPicker/components/SkinTonePicker.tsx b/app/components/IconPicker/components/SkinTonePicker.tsx index 4a4b8e7098..eef140416f 100644 --- a/app/components/IconPicker/components/SkinTonePicker.tsx +++ b/app/components/IconPicker/components/SkinTonePicker.tsx @@ -27,7 +27,7 @@ const SkinTonePicker = ({ }); const handleSkinClick = useCallback( - (emojiSkin) => { + (emojiSkin: any) => { menu.hide(); onChange(emojiSkin); }, diff --git a/app/components/InputSearch.tsx b/app/components/InputSearch.tsx index fb65b11cf9..6d361f7a32 100644 --- a/app/components/InputSearch.tsx +++ b/app/components/InputSearch.tsx @@ -29,7 +29,7 @@ function InputSearch( } = props; const handleFocus = React.useCallback( - (event) => { + (event: any) => { setIsFocused(true); onFocus?.(event); }, @@ -37,7 +37,7 @@ function InputSearch( ); const handleBlur = React.useCallback( - (event) => { + (event: any) => { setIsFocused(false); onBlur?.(event); }, diff --git a/app/components/SearchPopover.tsx b/app/components/SearchPopover.tsx index 5c77b86286..1975fadc7a 100644 --- a/app/components/SearchPopover.tsx +++ b/app/components/SearchPopover.tsx @@ -53,7 +53,7 @@ function SearchPopover({ shareId, className }: Props) { }, [searchResults, query, show]); const performSearch = React.useCallback( - async ({ query: searchQuery, ...options }) => { + async ({ query: searchQuery, ...options }: any) => { if (searchQuery?.length > 0) { const response = await documents.search({ query: searchQuery, diff --git a/app/components/Sharing/Collection/SharePopover.tsx b/app/components/Sharing/Collection/SharePopover.tsx index 0d76743dcf..7a8e244768 100644 --- a/app/components/Sharing/Collection/SharePopover.tsx +++ b/app/components/Sharing/Collection/SharePopover.tsx @@ -111,7 +111,7 @@ function SharePopover({ collection, visible, onRequestClose }: Props) { }, [pendingIds, prevPendingIds]); const handleQuery = React.useCallback( - (event) => { + (event: any) => { showPicker(); setQuery(event.target.value); }, diff --git a/app/components/Sharing/Document/DocumentMemberList.tsx b/app/components/Sharing/Document/DocumentMemberList.tsx index 52cae327c9..34f6eb59d7 100644 --- a/app/components/Sharing/Document/DocumentMemberList.tsx +++ b/app/components/Sharing/Document/DocumentMemberList.tsx @@ -38,7 +38,7 @@ function DocumentMembersList({ document, invitedInSession }: Props) { const theme = useTheme(); const handleRemoveUser = React.useCallback( - async (item) => { + async (item: any) => { try { await userMemberships.delete({ documentId: document.id, @@ -62,7 +62,7 @@ function DocumentMembersList({ document, invitedInSession }: Props) { ); const handleUpdateUser = React.useCallback( - async (userToUpdate, permission) => { + async (userToUpdate: any, permission: any) => { try { await userMemberships.create({ documentId: document.id, diff --git a/app/components/Sharing/Document/SharePopover.tsx b/app/components/Sharing/Document/SharePopover.tsx index 007633977c..ff79d3dc0d 100644 --- a/app/components/Sharing/Document/SharePopover.tsx +++ b/app/components/Sharing/Document/SharePopover.tsx @@ -230,7 +230,7 @@ function SharePopover({ document, onRequestClose, visible }: Props) { ); const handleQuery = React.useCallback( - (event) => { + (event: any) => { showPicker(); setQuery(event.target.value); }, diff --git a/app/components/Sharing/components/SearchInput.tsx b/app/components/Sharing/components/SearchInput.tsx index 3bcf3c63c2..56aed62bef 100644 --- a/app/components/Sharing/components/SearchInput.tsx +++ b/app/components/Sharing/components/SearchInput.tsx @@ -26,7 +26,7 @@ export const SearchInput = React.forwardRef(function _SearchInput( const isMobile = useMobile(); const focusInput = React.useCallback( - (event) => { + (event: any) => { if (event.target.closest("button")) { return; } diff --git a/app/components/Sidebar/App.tsx b/app/components/Sidebar/App.tsx index c7d356e5d4..9c3d4f97dd 100644 --- a/app/components/Sidebar/App.tsx +++ b/app/components/Sidebar/App.tsx @@ -47,7 +47,7 @@ function AppSidebar() { }, [documents, collections, user.isViewer]); const [dndArea, setDndArea] = useState(); - const handleSidebarRef = useCallback((node) => setDndArea(node), []); + const handleSidebarRef = useCallback((node: any) => setDndArea(node), []); const html5Options = useMemo( () => ({ rootElement: dndArea, diff --git a/app/components/Sidebar/Right.tsx b/app/components/Sidebar/Right.tsx index b70e2e3189..0879735b93 100644 --- a/app/components/Sidebar/Right.tsx +++ b/app/components/Sidebar/Right.tsx @@ -50,7 +50,7 @@ function Right({ children, border, className }: Props) { } }, []); - const handleMouseDown = React.useCallback((event) => { + const handleMouseDown = React.useCallback((event: any) => { event.preventDefault(); setResizing(true); }, []); diff --git a/app/components/Sidebar/Sidebar.tsx b/app/components/Sidebar/Sidebar.tsx index 065b55997a..b8a8611e41 100644 --- a/app/components/Sidebar/Sidebar.tsx +++ b/app/components/Sidebar/Sidebar.tsx @@ -101,7 +101,7 @@ const Sidebar = React.forwardRef(function _Sidebar( }, []); const handleMouseDown = React.useCallback( - (event) => { + (event: any) => { event.preventDefault(); if (!document.hasFocus()) { return; @@ -126,7 +126,7 @@ const Sidebar = React.forwardRef(function _Sidebar( }, [ui.sidebarIsClosed]); const handlePointerLeave = React.useCallback( - (ev) => { + (ev: any) => { if (hasPointerMoved) { // clear any previous timeout if (hoverTimeoutRef.current) { diff --git a/app/components/Sidebar/components/ArchiveLink.tsx b/app/components/Sidebar/components/ArchiveLink.tsx index f48feef8e7..3f7a979c1b 100644 --- a/app/components/Sidebar/components/ArchiveLink.tsx +++ b/app/components/Sidebar/components/ArchiveLink.tsx @@ -51,7 +51,7 @@ function ArchiveLink() { } }, [expanded, request]); - const handleDisclosureClick = useCallback((ev) => { + const handleDisclosureClick = useCallback((ev: any) => { ev.preventDefault(); ev.stopPropagation(); setExpanded((e) => !e); diff --git a/app/components/Sidebar/components/ArchivedCollectionLink.tsx b/app/components/Sidebar/components/ArchivedCollectionLink.tsx index fd82407276..143cda93a5 100644 --- a/app/components/Sidebar/components/ArchivedCollectionLink.tsx +++ b/app/components/Sidebar/components/ArchivedCollectionLink.tsx @@ -15,7 +15,7 @@ export function ArchivedCollectionLink({ collection, depth }: Props) { const [expanded, setExpanded] = useState(false); - const handleDisclosureClick = useCallback((ev) => { + const handleDisclosureClick = useCallback((ev: any) => { ev.preventDefault(); ev.stopPropagation(); setExpanded((e) => !e); diff --git a/app/components/Sidebar/components/CollectionLink.tsx b/app/components/Sidebar/components/CollectionLink.tsx index ee4e3807f0..a81e5c1ba3 100644 --- a/app/components/Sidebar/components/CollectionLink.tsx +++ b/app/components/Sidebar/components/CollectionLink.tsx @@ -88,7 +88,7 @@ const CollectionLink: React.FC> = ({ useBoolean(); const handleNewDoc = React.useCallback( - async (input) => { + async (input: any) => { const newDocument = await documents.create( { collectionId: collection.id, diff --git a/app/components/Sidebar/components/DocumentLink.tsx b/app/components/Sidebar/components/DocumentLink.tsx index d1c01c297a..371b8bbcc3 100644 --- a/app/components/Sidebar/components/DocumentLink.tsx +++ b/app/components/Sidebar/components/DocumentLink.tsx @@ -118,7 +118,7 @@ function InnerDocumentLink( }, [setCollapsed, expanded, hasChildDocuments]); const handleDisclosureClick = React.useCallback( - (ev) => { + (ev: any) => { ev?.preventDefault(); if (expanded) { setCollapsed(); @@ -233,7 +233,7 @@ function InnerDocumentLink( useBoolean(); const handleNewDoc = React.useCallback( - async (input) => { + async (input: any) => { const newDocument = await documents.create( { collectionId: collection?.id, diff --git a/app/components/Sidebar/components/DraggableCollectionLink.tsx b/app/components/Sidebar/components/DraggableCollectionLink.tsx index fb9a3e53d5..4073b8ef67 100644 --- a/app/components/Sidebar/components/DraggableCollectionLink.tsx +++ b/app/components/Sidebar/components/DraggableCollectionLink.tsx @@ -93,7 +93,7 @@ function DraggableCollectionLink({ locationSidebarContext, ]); - const handleDisclosureClick = useCallback((ev) => { + const handleDisclosureClick = useCallback((ev: any) => { ev?.preventDefault(); setExpanded((e) => !e); }, []); diff --git a/app/components/Sidebar/components/GroupLink.tsx b/app/components/Sidebar/components/GroupLink.tsx index 3d6082a3bd..dfaaa6f386 100644 --- a/app/components/Sidebar/components/GroupLink.tsx +++ b/app/components/Sidebar/components/GroupLink.tsx @@ -21,7 +21,7 @@ const GroupLink: React.FC> = ({ group }) => { locationSidebarContext === sidebarContext ); - const handleDisclosureClick = React.useCallback((ev) => { + const handleDisclosureClick = React.useCallback((ev: any) => { ev?.preventDefault(); setExpanded((e) => !e); }, []); diff --git a/app/editor/components/FindAndReplace.tsx b/app/editor/components/FindAndReplace.tsx index 653fc8ca1e..f5fb984812 100644 --- a/app/editor/components/FindAndReplace.tsx +++ b/app/editor/components/FindAndReplace.tsx @@ -249,7 +249,7 @@ export default function FindAndReplace({ ); const handleReplace = React.useCallback( - (ev) => { + (ev: any) => { if (readOnly) { return; } @@ -260,7 +260,7 @@ export default function FindAndReplace({ ); const handleReplaceAll = React.useCallback( - (ev) => { + (ev: any) => { if (readOnly) { return; } diff --git a/app/editor/components/SuggestionsMenu.tsx b/app/editor/components/SuggestionsMenu.tsx index 966d451c77..98bcf076e9 100644 --- a/app/editor/components/SuggestionsMenu.tsx +++ b/app/editor/components/SuggestionsMenu.tsx @@ -251,7 +251,7 @@ function SuggestionsMenu(props: Props) { ); const handleClickItem = React.useCallback( - (item) => { + (item: any) => { props.onSelect?.(item); switch (item.name) { diff --git a/app/editor/components/SuggestionsMenuItem.tsx b/app/editor/components/SuggestionsMenuItem.tsx index 199548ca3a..52315f5136 100644 --- a/app/editor/components/SuggestionsMenuItem.tsx +++ b/app/editor/components/SuggestionsMenuItem.tsx @@ -36,7 +36,7 @@ function SuggestionsMenuItem({ }: Props) { const portal = usePortalContext(); const ref = React.useCallback( - (node) => { + (node: any) => { if (selected && node) { scrollIntoView(node, { scrollMode: "if-needed", diff --git a/app/scenes/ApiKeyNew/index.tsx b/app/scenes/ApiKeyNew/index.tsx index 3ce8faef1a..cbab217385 100644 --- a/app/scenes/ApiKeyNew/index.tsx +++ b/app/scenes/ApiKeyNew/index.tsx @@ -48,11 +48,11 @@ function ApiKeyNew({ onSubmit }: Props) { [] ); - const handleNameChange = React.useCallback((event) => { + const handleNameChange = React.useCallback((event: any) => { setName(event.target.value); }, []); - const handleScopeChange = React.useCallback((event) => { + const handleScopeChange = React.useCallback((event: any) => { setScope(event.target.value); }, []); diff --git a/app/scenes/Document/components/Comments.tsx b/app/scenes/Document/components/Comments.tsx index 079ccc0c19..f0df50dc32 100644 --- a/app/scenes/Document/components/Comments.tsx +++ b/app/scenes/Document/components/Comments.tsx @@ -177,8 +177,9 @@ function Comments() { )} + {/* @ts-expect-error - framer-motion v4 has TypeScript compatibility issues with React 18 */} - {!focusedComment && can.comment && !viewingResolved && ( + {!focusedComment && can.comment && !viewingResolved ? ( - )} + ) : null} ); diff --git a/app/scenes/Document/components/ObservingBanner.tsx b/app/scenes/Document/components/ObservingBanner.tsx index ff3e5d85c3..006ecdd95c 100644 --- a/app/scenes/Document/components/ObservingBanner.tsx +++ b/app/scenes/Document/components/ObservingBanner.tsx @@ -23,8 +23,9 @@ function ObservingBanner() { return ( + {/* @ts-expect-error - framer-motion v4 has TypeScript compatibility issues with React 18 */} - {user && ( + {user ? ( {t("Observing {{ userName }}", { userName: user.name })} - )} + ) : null} ); diff --git a/app/scenes/Invite.tsx b/app/scenes/Invite.tsx index 4c22b2824d..b8dfdf1f23 100644 --- a/app/scenes/Invite.tsx +++ b/app/scenes/Invite.tsx @@ -71,7 +71,7 @@ function Invite({ onSubmit }: Props) { [onSubmit, invites, role, t, users] ); - const handleChange = React.useCallback((ev, index: number) => { + const handleChange = React.useCallback((ev: any, index: number) => { setInvites((prevInvites) => { const newInvites = [...prevInvites]; newInvites[index][ev.target.name as keyof InviteRequest] = diff --git a/app/scenes/KeyboardShortcuts.tsx b/app/scenes/KeyboardShortcuts.tsx index e4558f6523..6d1d4901db 100644 --- a/app/scenes/KeyboardShortcuts.tsx +++ b/app/scenes/KeyboardShortcuts.tsx @@ -501,11 +501,11 @@ function KeyboardShortcuts() { ); const [searchTerm, setSearchTerm] = useState(""); const normalizedSearchTerm = searchTerm.toLocaleLowerCase(); - const handleChange = useCallback((event) => { + const handleChange = useCallback((event: any) => { setSearchTerm(event.target.value); }, []); - const handleKeyDown = useCallback((event) => { + const handleKeyDown = useCallback((event: any) => { if (event.currentTarget.value && event.key === "Escape") { event.preventDefault(); event.stopPropagation(); diff --git a/app/scenes/Login/Login.tsx b/app/scenes/Login/Login.tsx index a4f03a4ca6..50beda7bfb 100644 --- a/app/scenes/Login/Login.tsx +++ b/app/scenes/Login/Login.tsx @@ -67,11 +67,11 @@ function Login({ children, onBack }: Props) { const handleReset = React.useCallback(() => { setEmailLinkSentTo(""); }, []); - const handleEmailSuccess = React.useCallback((email) => { + const handleEmailSuccess = React.useCallback((email: any) => { setEmailLinkSentTo(email); }, []); - const handleGoSubdomain = React.useCallback(async (event) => { + const handleGoSubdomain = React.useCallback(async (event: any) => { event.preventDefault(); const data = Object.fromEntries(new FormData(event.target)); await navigateToSubdomain(data.subdomain.toString()); diff --git a/app/scenes/Settings/Groups.tsx b/app/scenes/Settings/Groups.tsx index d48138e955..a6b007b6ec 100644 --- a/app/scenes/Settings/Groups.tsx +++ b/app/scenes/Settings/Groups.tsx @@ -89,7 +89,7 @@ function Groups() { [params, history, location.pathname] ); - const handleSearch = useCallback((event) => { + const handleSearch = useCallback((event: any) => { const { value } = event.target; setQuery(value); }, []); diff --git a/app/scenes/Settings/Members.tsx b/app/scenes/Settings/Members.tsx index d2a947d2fe..875514a712 100644 --- a/app/scenes/Settings/Members.tsx +++ b/app/scenes/Settings/Members.tsx @@ -89,16 +89,16 @@ function Members() { ); const handleStatusFilter = useCallback( - (status) => updateParams("filter", status), + (status: any) => updateParams("filter", status), [updateParams] ); const handleRoleFilter = useCallback( - (role) => updateParams("role", role), + (role: any) => updateParams("role", role), [updateParams] ); - const handleSearch = useCallback((event) => { + const handleSearch = useCallback((event: any) => { const { value } = event.target; setQuery(value); }, []); diff --git a/app/scenes/Settings/Preferences.tsx b/app/scenes/Settings/Preferences.tsx index bb13431cc5..e71f911ba2 100644 --- a/app/scenes/Settings/Preferences.tsx +++ b/app/scenes/Settings/Preferences.tsx @@ -103,7 +103,7 @@ function Preferences() { ); const handleThemeChange = React.useCallback( - (theme) => { + (theme: any) => { ui.setTheme(theme as Theme); toast.success(t("Preferences saved")); }, diff --git a/app/scenes/Settings/Security.tsx b/app/scenes/Settings/Security.tsx index 973a62facf..6d2dcd8155 100644 --- a/app/scenes/Settings/Security.tsx +++ b/app/scenes/Settings/Security.tsx @@ -76,7 +76,7 @@ function Security() { ); const saveData = React.useCallback( - async (newData) => { + async (newData: any) => { try { setData((prev) => ({ ...prev, ...newData })); await team.save(newData); diff --git a/app/scenes/Settings/Shares.tsx b/app/scenes/Settings/Shares.tsx index 481ff69e83..7232ab1df3 100644 --- a/app/scenes/Settings/Shares.tsx +++ b/app/scenes/Settings/Shares.tsx @@ -72,7 +72,7 @@ function Shares() { [params, history, location.pathname] ); - const handleSearch = useCallback((event) => { + const handleSearch = useCallback((event: any) => { const { value } = event.target; setQuery(value); }, []);