diff --git a/components/toast_wrapper/.eslintrc b/components/toast_wrapper/.eslintrc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/components/toast_wrapper/index.tsx b/components/toast_wrapper/index.tsx index 0cc22f80d038..f402da91950b 100644 --- a/components/toast_wrapper/index.tsx +++ b/components/toast_wrapper/index.tsx @@ -45,6 +45,9 @@ export function makeGetRootPosts() { (post as any).state !== Posts.POST_DELETED); }).reduce((map, obj) => { (map as any)[(obj as any).id] = true; + // line 49 and line 50 added for Diego + // eslint-disable-next-line no-console + console.log(map); return map; }, {}); }, diff --git a/components/toast_wrapper/toast_wrapper.test.tsx b/components/toast_wrapper/toast_wrapper.test.tsx index 6e9d8ead1737..a866eceb88e4 100644 --- a/components/toast_wrapper/toast_wrapper.test.tsx +++ b/components/toast_wrapper/toast_wrapper.test.tsx @@ -3,8 +3,7 @@ import React from 'react'; -// @ts-expect-error TS(2307): Cannot find module 'mattermost-redux/constants/pre... Remove this comment to see the full error message -import Preferences from 'mattermost-redux/constants/preferences'; +import Preferences from '@mattermost/constants/preferences'; // @ts-expect-error TS(2307): Cannot find module 'mattermost-redux/utils/post_li... Remove this comment to see the full error message import {DATE_LINE} from 'mattermost-redux/utils/post_list'; diff --git a/components/toast_wrapper/toast_wrapper.tsx b/components/toast_wrapper/toast_wrapper.tsx index 3cfe3e80f6c1..db6c7d4a47c4 100644 --- a/components/toast_wrapper/toast_wrapper.tsx +++ b/components/toast_wrapper/toast_wrapper.tsx @@ -4,7 +4,6 @@ import React from 'react'; import {FormattedMessage, injectIntl} from 'react-intl'; -// @ts-expect-error TS(2307): Cannot find module 'components/toast/toast' or its... Remove this comment to see the full error message import Toast from 'components/toast/toast'; // @ts-expect-error TS(2307): Cannot find module 'components/timestamp' or its c... Remove this comment to see the full error message @@ -19,9 +18,9 @@ import * as Utils from 'utils/utils'; // @ts-expect-error TS(2307): Cannot find module 'utils/datetime' or its corresp... Remove this comment to see the full error message import {isToday} from 'utils/datetime'; -// @ts-expect-error TS(2307): Cannot find module 'utils/constants' or its corres... Remove this comment to see the full error message import Constants from 'utils/constants'; + // @ts-expect-error TS(2307): Cannot find module 'utils/browser_history' or its ... Remove this comment to see the full error message import {browserHistory} from 'utils/browser_history'; @@ -47,7 +46,7 @@ type OwnProps = { isCollapsedThreadsEnabled?: boolean; rootPosts?: $TSFixMe; atLatestPost?: boolean; - postListIds?: $TSFixMe[]; + postListIds?: string[]; latestPostTimeStamp?: number; atBottom?: boolean; lastViewedBottom?: number; @@ -56,20 +55,15 @@ type OwnProps = { focusedPostId?: string; initScrollOffsetFromBottom?: number; - // @ts-expect-error TS(2552): Cannot find name '$TSFixMeFunction'. Did you mean ... Remove this comment to see the full error message - updateNewMessagesAtInChannel?: $TSFixMeFunction; + updateNewMessagesAtInChannel?: (lastViewedBottom?: number) => void; - // @ts-expect-error TS(2552): Cannot find name '$TSFixMeFunction'. Did you mean ... Remove this comment to see the full error message - scrollToNewMessage?: $TSFixMeFunction; + scrollToNewMessage?: () => void; - // @ts-expect-error TS(2552): Cannot find name '$TSFixMeFunction'. Did you mean ... Remove this comment to see the full error message - scrollToLatestMessages?: $TSFixMeFunction; + scrollToLatestMessages?: () => void; - // @ts-expect-error TS(2552): Cannot find name '$TSFixMeFunction'. Did you mean ... Remove this comment to see the full error message - scrollToUnreadMessages?: $TSFixMeFunction; + scrollToUnreadMessages?: () => void; - // @ts-expect-error TS(2552): Cannot find name '$TSFixMeFunction'. Did you mean ... Remove this comment to see the full error message - updateLastViewedBottomAt?: $TSFixMeFunction; + updateLastViewedBottomAt?: (lastViewedBottom?: number) => void; showSearchHintToast?: boolean; // @ts-expect-error TS(2552): Cannot find name '$TSFixMeFunction'. Did you mean ... Remove this comment to see the full error message @@ -105,14 +99,14 @@ class ToastWrapper extends React.PureComponent { }; } - static countNewMessages = (postListIds: $TSFixMe, rootPosts: $TSFixMe, isCollapsedThreadsEnabled: $TSFixMe) => { + static countNewMessages = (postListIds: string[], rootPosts: $TSFixMe, isCollapsedThreadsEnabled: boolean) => { const mark = getNewMessageIndex(postListIds); if (mark <= 0) { return 0; } - let newMessages = postListIds.slice(0, mark).filter((id: $TSFixMe) => !isIdNotPost(id)); + let newMessages = postListIds.slice(0, mark).filter((id: string) => !isIdNotPost(id)); if (isCollapsedThreadsEnabled) { // in collapsed mode we only count root posts - newMessages = newMessages.filter((id: $TSFixMe) => rootPosts[id]); + newMessages = newMessages.filter((id: string) => rootPosts[id]); } return newMessages.length; } diff --git a/components/toast_wrapper/tsconfig.json b/components/toast_wrapper/tsconfig.json index 371850644ba7..35d6dce3480e 100644 --- a/components/toast_wrapper/tsconfig.json +++ b/components/toast_wrapper/tsconfig.json @@ -46,7 +46,7 @@ /* Module Resolution Options */ // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + "paths": {"components/" : ["./components"]}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */