ReactJS @mui/material Typography children type error

Viewed 20
      {/* Mobile Version */}
      <Hidden mdUp>
        <Box pb={44}>
          {discussions?.map((discussion) => {
            return (
              <Box
                key={discussion.id}
                mb={3}
                bgcolor="custom.blueishGrey"
                borderRadius="2px"
                sx={{ padding: (theme) => theme.spacing(2, 1, 3, 1) }}
              >
                <Box mb={5} display="flex">
                  <Box mr={2} width={80}>
                    <Typography className={classes.labelText}>Status</Typography>
                  </Box>
                  {discussion.viewCount ? (
                    <Box display="flex" alignItems="center">
                      <VisibilityIcon className={classes.actions} />
                      <Typography mr={2} fontSize={[10, 14]} ml={1} className={classes.actions}>
                        {discussion.viewCount}
                      </Typography>
                      <SmsIcon className={classes.actions} />
                      <Typography fontSize={[10, 14]} ml={1} className={classes.actions}>
                        {discussion.comments}
                      </Typography>
                    </Box>
                  ) : (
                    <Typography fontSize={[10, 14]} className={classes.actions}>
                      -
                    </Typography>
                  )}
                </Box>

yarn build error:

./src/views/Dashboard/Articles/Discussions.tsx:244:25
Type error: No overload matches this call.
  Overload 1 of 2, '(props: { component: ElementType<any>; } & SystemProps<Theme> & { align?: "left" | "right" | "inherit" | "center" | "justify"; children?: ReactNode; ... 6 more ...; variantMapping?: Partial<...>; } & CommonProps & Omit<...>): Element', gave the following error.
    Type '{ __typename: "CommentType"; id: string; createdAt?: string; updatedAt?: string; status: CommentStatusEnum; content: string; userID: string; user: { __typename: "CommunityUserType"; userID: string; email?: string; avatar?: { ...; }[]; name: string; }; parentID?: string; }[]' is not assignable to type 'ReactNode'.
      Type '{ __typename: "CommentType"; id: string; createdAt?: string; updatedAt?: string; status: CommentStatusEnum; content: string; userID: string; user: { __typename: "CommunityUserType"; userID: string; email?: string; avatar?: { ...; }[]; name: string; }; parentID?: string; }[]' is not assignable to type 'ReactFragment'.
        The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
          Type 'IteratorResult<{ __typename: "CommentType"; id: string; createdAt?: string; updatedAt?: string; status: CommentStatusEnum; content: string; userID: string; user: { __typename: "CommunityUserType"; userID: string; email?: string; avatar?: { ...; }[]; name: string; }; parentID?: string; }, any>' is not assignable to type 'IteratorResult<ReactNode, any>'.
            Type 'IteratorYieldResult<{ __typename: "CommentType"; id: string; createdAt?: string; updatedAt?: string; status: CommentStatusEnum; content: string; userID: string; user: { __typename: "CommunityUserType"; userID: string; email?: string; avatar?: { ...; }[]; name: string; }; parentID?: string; }>' is not assignable to type 'IteratorResult<ReactNode, any>'.
              Type 'IteratorYieldResult<{ __typename: "CommentType"; id: string; createdAt?: string; updatedAt?: string; status: CommentStatusEnum; content: string; userID: string; user: { __typename: "CommunityUserType"; userID: string; email?: string; avatar?: { ...; }[]; name: string; }; parentID?: string; }>' is not assignable to type 'IteratorYieldResult<ReactNode>'.
                Type '{ __typename: "CommentType"; id: string; createdAt?: string; updatedAt?: string; status: CommentStatusEnum; content: string; userID: string; user: { __typename: "CommunityUserType"; userID: string; email?: string; avatar?: { ...; }[]; name: string; }; parentID?: string; }' is not assignable to type 'ReactNode'.
  Overload 2 of 2, '(props: DefaultComponentProps<TypographyTypeMap<{}, "span">>): Element', gave the following error.
    Type '{ __typename: "CommentType"; id: string; createdAt?: string; updatedAt?: string; status: CommentStatusEnum; content: string; userID: string; user: { __typename: "CommunityUserType"; userID: string; email?: string; avatar?: { ...; }[]; name: string; }; parentID?: string; }[]' is not assignable to type 'ReactNode'.

  242 |                       <SmsIcon className={classes.actions} />
  243 |                       <Typography fontSize={[10, 14]} ml={1} className={classes.actions}>
> 244 |                         {discussion.comments}
      |                         ^
  245 |                       </Typography>
  246 |                     </Box>
  247 |                   ) : (
0 Answers
Related