chore: cleanup

This commit is contained in:
Tom Moor
2022-04-30 08:24:58 -07:00
parent 677ca10b2b
commit a736022c39
10 changed files with 22 additions and 23 deletions

View File

@@ -12,7 +12,7 @@ const Container = styled.div<Props>`
padding: ${(props) => (props.withStickyHeader ? "4px 12px" : "60px 12px")}; padding: ${(props) => (props.withStickyHeader ? "4px 12px" : "60px 12px")};
${breakpoint("tablet")` ${breakpoint("tablet")`
padding: ${(props: any) => padding: ${(props: Props) =>
props.withStickyHeader ? "4px 44px 60px" : "60px 44px"}; props.withStickyHeader ? "4px 44px 60px" : "60px 44px"};
`}; `};
`; `;

View File

@@ -2,7 +2,7 @@ import * as React from "react";
import { MenuSeparator } from "reakit/Menu"; import { MenuSeparator } from "reakit/Menu";
import styled from "styled-components"; import styled from "styled-components";
export default function Separator(rest: any) { export default function Separator(rest: React.HTMLAttributes<HTMLHRElement>) {
return ( return (
<MenuSeparator {...rest}> <MenuSeparator {...rest}>
{(props) => <HorizontalRule {...props} />} {(props) => <HorizontalRule {...props} />}

View File

@@ -19,7 +19,7 @@ type Props = RootStore & {
membership?: CollectionGroupMembership; membership?: CollectionGroupMembership;
showFacepile?: boolean; showFacepile?: boolean;
showAvatar?: boolean; showAvatar?: boolean;
renderActions: (arg0: { openMembersModal: () => void }) => React.ReactNode; renderActions: (params: { openMembersModal: () => void }) => React.ReactNode;
}; };
@observer @observer

View File

@@ -1,8 +1,15 @@
import * as React from "react"; import * as React from "react";
import { NavLink, Route } from "react-router-dom"; import { match, NavLink, Route } from "react-router-dom";
type Props = React.ComponentProps<typeof NavLink> & { type Props = React.ComponentProps<typeof NavLink> & {
children?: (match: any) => React.ReactNode; children?: (
match:
| match<{
[x: string]: string | undefined;
}>
| boolean
| null
) => React.ReactNode;
exact?: boolean; exact?: boolean;
activeStyle?: React.CSSProperties; activeStyle?: React.CSSProperties;
to: string; to: string;

View File

@@ -14,7 +14,7 @@ type Props = {
collection: Collection | null | undefined; collection: Collection | null | undefined;
onSuccess?: () => void; onSuccess?: () => void;
style?: React.CSSProperties; style?: React.CSSProperties;
ref?: (arg0: React.ElementRef<"div"> | null | undefined) => void; ref?: (element: React.ElementRef<"div"> | null | undefined) => void;
}; };
@observer @observer

View File

@@ -65,8 +65,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, Props>(
const handleStopDrag = React.useCallback(() => { const handleStopDrag = React.useCallback(() => {
setResizing(false); setResizing(false);
if (document.activeElement) { if (document.activeElement instanceof HTMLElement) {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'blur' does not exist on type 'Element'.
document.activeElement.blur(); document.activeElement.blur();
} }

View File

@@ -1,11 +1,11 @@
import * as React from "react"; import * as React from "react";
export default function useDebouncedCallback( export default function useDebouncedCallback<T>(
callback: (arg0: any) => unknown, callback: (...params: T[]) => unknown,
wait: number wait: number
) { ) {
// track args & timeout handle between calls // track args & timeout handle between calls
const argsRef = React.useRef(); const argsRef = React.useRef<T[]>();
const timeout = React.useRef<ReturnType<typeof setTimeout>>(); const timeout = React.useRef<ReturnType<typeof setTimeout>>();
function cleanup() { function cleanup() {
@@ -16,12 +16,11 @@ export default function useDebouncedCallback(
// make sure our timeout gets cleared if consuming component gets unmounted // make sure our timeout gets cleared if consuming component gets unmounted
React.useEffect(() => cleanup, []); React.useEffect(() => cleanup, []);
return function (...args: any) { return function (...args: T[]) {
argsRef.current = args; argsRef.current = args;
cleanup(); cleanup();
timeout.current = setTimeout(() => { timeout.current = setTimeout(() => {
if (argsRef.current) { if (argsRef.current) {
// @ts-expect-error ts-migrate(2556) FIXME: Expected 1 arguments, but got 0 or more.
callback(...argsRef.current); callback(...argsRef.current);
} }
}, wait); }, wait);

View File

@@ -241,8 +241,8 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
// we must prevent the user from continuing to edit as their changes will not // we must prevent the user from continuing to edit as their changes will not
// be persisted. See: https://github.com/yjs/yjs/issues/303 // be persisted. See: https://github.com/yjs/yjs/issues/303
React.useEffect(() => { React.useEffect(() => {
function onUnhandledError(err: any) { function onUnhandledError(event: ErrorEvent) {
if (err.message.includes("URIError: URI malformed")) { if (event.message.includes("URIError: URI malformed")) {
showToast( showToast(
t( t(
"Sorry, the last change could not be persisted please reload the page" "Sorry, the last change could not be persisted please reload the page"

View File

@@ -223,7 +223,7 @@ function Invite({ onSubmit }: Props) {
required={!!invite.email} required={!!invite.email}
/> />
<InputSelectRole <InputSelectRole
onChange={(role: any) => handleRoleChange(role as Role, index)} onChange={(role: Role) => handleRoleChange(role, index)}
value={invite.role} value={invite.role}
labelHidden={index !== 0} labelHidden={index !== 0}
short short

View File

@@ -14,8 +14,6 @@ import withStores from "~/components/withStores";
import { compressImage } from "~/utils/compressImage"; import { compressImage } from "~/utils/compressImage";
import { uploadFile, dataUrlToBlob } from "~/utils/files"; import { uploadFile, dataUrlToBlob } from "~/utils/files";
const EMPTY_OBJECT = {};
export type Props = { export type Props = {
onSuccess: (url: string) => void | Promise<void>; onSuccess: (url: string) => void | Promise<void>;
onError: (error: string) => void; onError: (error: string) => void;
@@ -84,7 +82,7 @@ class ImageUpload extends React.Component<RootStore & Props> {
this.isCropping = false; this.isCropping = false;
}; };
handleZoom = (event: React.DragEvent<any>) => { handleZoom = (event: React.ChangeEvent<HTMLInputElement>) => {
const target = event.target; const target = event.target;
if (target instanceof HTMLInputElement) { if (target instanceof HTMLInputElement) {
@@ -119,7 +117,6 @@ class ImageUpload extends React.Component<RootStore & Props> {
max="2" max="2"
step="0.01" step="0.01"
defaultValue="1" defaultValue="1"
// @ts-expect-error ts-migrate(2769) FIXME: No overload matches this call.
onChange={this.handleZoom} onChange={this.handleZoom}
/> />
<CropButton onClick={this.handleCrop} disabled={this.isUploading}> <CropButton onClick={this.handleCrop} disabled={this.isUploading}>
@@ -139,9 +136,6 @@ class ImageUpload extends React.Component<RootStore & Props> {
<Dropzone <Dropzone
accept="image/png, image/jpeg" accept="image/png, image/jpeg"
onDropAccepted={this.onDropAccepted} onDropAccepted={this.onDropAccepted}
// @ts-expect-error ts-migrate(2322) FIXME: Type '{ children: ({ getRootProps, getInputProps }... Remove this comment to see the full error message
style={EMPTY_OBJECT}
disablePreview
> >
{({ getRootProps, getInputProps }) => ( {({ getRootProps, getInputProps }) => (
<div {...getRootProps()}> <div {...getRootProps()}>