fix typescript weirdness while migrating from material v4

This commit is contained in:
Aria Moradi
2021-09-09 18:37:23 +04:30
parent 0869bb888f
commit 3154247300
4 changed files with 4 additions and 6 deletions

View File

@@ -48,7 +48,7 @@ const useStyles = makeStyles({
interface IProps { interface IProps {
manga: IMangaCard manga: IMangaCard
} }
const AnimeCard = React.forwardRef((props: IProps, ref) => { const AnimeCard = React.forwardRef<HTMLDivElement, IProps>((props: IProps, ref) => {
const { const {
manga: { manga: {
id, title, thumbnailUrl, id, title, thumbnailUrl,
@@ -60,7 +60,6 @@ const AnimeCard = React.forwardRef((props: IProps, ref) => {
return ( return (
<Grid item xs={6} sm={4} md={3} lg={2}> <Grid item xs={6} sm={4} md={3} lg={2}>
<Link to={`/anime/${id}/`}> <Link to={`/anime/${id}/`}>
{/* @ts-ignore */}
<Card className={classes.root} ref={ref}> <Card className={classes.root} ref={ref}>
<CardActionArea> <CardActionArea>
<div className={classes.wrapper}> <div className={classes.wrapper}>

View File

@@ -22,7 +22,7 @@ export default function AnimeGrid(props: IProps) {
mangas, message, hasNextPage, lastPageNum, setLastPageNum, mangas, message, hasNextPage, lastPageNum, setLastPageNum,
} = props; } = props;
let mapped; let mapped;
const lastManga = useRef<HTMLInputElement>(); const lastManga = useRef<HTMLInputElement>(null);
const scrollHandler = () => { const scrollHandler = () => {
if (lastManga.current) { if (lastManga.current) {

View File

@@ -66,7 +66,7 @@ const truncateText = (str: string, maxLength: number) => {
interface IProps { interface IProps {
manga: IMangaCard manga: IMangaCard
} }
const MangaCard = React.forwardRef((props: IProps, ref) => { const MangaCard = React.forwardRef<HTMLDivElement, IProps>((props: IProps, ref) => {
const { const {
manga: { manga: {
id, title, thumbnailUrl, id, title, thumbnailUrl,
@@ -78,7 +78,6 @@ const MangaCard = React.forwardRef((props: IProps, ref) => {
return ( return (
<Grid item xs={6} sm={4} md={3} lg={2}> <Grid item xs={6} sm={4} md={3} lg={2}>
<Link to={`/manga/${id}/`}> <Link to={`/manga/${id}/`}>
{/* @ts-ignore */}
<Card className={classes.root} ref={ref}> <Card className={classes.root} ref={ref}>
<CardActionArea> <CardActionArea>
<div className={classes.wrapper}> <div className={classes.wrapper}>

View File

@@ -22,7 +22,7 @@ export default function MangaGrid(props: IProps) {
mangas, message, hasNextPage, lastPageNum, setLastPageNum, mangas, message, hasNextPage, lastPageNum, setLastPageNum,
} = props; } = props;
let mapped; let mapped;
const lastManga = useRef<HTMLInputElement>(); const lastManga = useRef<HTMLDivElement>(null);
const scrollHandler = () => { const scrollHandler = () => {
if (lastManga.current) { if (lastManga.current) {