diff --git a/.eslintrc.js b/.eslintrc.js index 7b746c6ff..a563a543b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -129,6 +129,8 @@ const typescriptRules = { // Upgrade from a warning '@typescript-eslint/explicit-module-boundary-types': 'error', + '@typescript-eslint/consistent-type-imports': 'error', + // Already enforced by TypeScript 'consistent-return': 'off', }; diff --git a/app/SystemTrayService.ts b/app/SystemTrayService.ts index f57b16621..6a314f549 100644 --- a/app/SystemTrayService.ts +++ b/app/SystemTrayService.ts @@ -2,14 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { join } from 'path'; -import { - BrowserWindow, - Menu, - NativeImage, - Tray, - app, - nativeImage, -} from 'electron'; +import type { BrowserWindow, NativeImage } from 'electron'; +import { Menu, Tray, app, nativeImage } from 'electron'; import * as log from '../ts/logging/log'; import type { LocaleMessagesType } from '../ts/types/I18N'; diff --git a/app/global_errors.ts b/app/global_errors.ts index d29aa0396..bc79d6298 100644 --- a/app/global_errors.ts +++ b/app/global_errors.ts @@ -5,7 +5,7 @@ import { app, dialog, clipboard } from 'electron'; import * as Errors from '../ts/types/errors'; import { redactAll } from '../ts/util/privacy'; -import { LocaleMessagesType } from '../ts/types/I18N'; +import type { LocaleMessagesType } from '../ts/types/I18N'; import { reallyJsonStringify } from '../ts/util/reallyJsonStringify'; // We use hard-coded strings until we're able to update these strings from the locale. diff --git a/app/locale.ts b/app/locale.ts index a0cdcb858..4503a8fb4 100644 --- a/app/locale.ts +++ b/app/locale.ts @@ -6,9 +6,9 @@ import { readFileSync } from 'fs'; import { merge } from 'lodash'; import { setupI18n } from '../ts/util/setupI18n'; -import { LoggerType } from '../ts/types/Logging'; -import { LocaleMessagesType } from '../ts/types/I18N'; -import { LocalizerType } from '../ts/types/Util'; +import type { LoggerType } from '../ts/types/Logging'; +import type { LocaleMessagesType } from '../ts/types/I18N'; +import type { LocalizerType } from '../ts/types/Util'; function normalizeLocaleName(locale: string): string { if (/^en-/.test(locale)) { diff --git a/app/main.ts b/app/main.ts index f523719cd..47881df1d 100644 --- a/app/main.ts +++ b/app/main.ts @@ -34,7 +34,8 @@ import { consoleLogger } from '../ts/util/consoleLogger'; import './startup_config'; -import config, { ConfigType } from './config'; +import type { ConfigType } from './config'; +import config from './config'; import { Environment, getEnvironment, @@ -63,7 +64,8 @@ import * as logging from '../ts/logging/main_process_logging'; import { MainSQL } from '../ts/sql/main'; import * as sqlChannels from './sql_channel'; import * as windowState from './window_state'; -import { createTemplate, MenuOptionsType } from './menu'; +import type { MenuOptionsType } from './menu'; +import { createTemplate } from './menu'; import { installFileHandler, installWebHandler } from './protocol_filter'; import * as OS from '../ts/OS'; import { isProduction } from '../ts/util/version'; @@ -87,7 +89,8 @@ import { SettingsChannel } from '../ts/main/settingsChannel'; import { maybeParseUrl, setUrlSearchParams } from '../ts/util/url'; import { getHeicConverter } from '../ts/workers/heicConverterMain'; -import { load as loadLocale, LocaleType } from './locale'; +import type { LocaleType } from './locale'; +import { load as loadLocale } from './locale'; import type { LoggerType } from '../ts/types/Logging'; diff --git a/app/menu.ts b/app/menu.ts index 0c8f0bdad..04eb4acc3 100644 --- a/app/menu.ts +++ b/app/menu.ts @@ -2,9 +2,9 @@ // SPDX-License-Identifier: AGPL-3.0-only import { isString } from 'lodash'; -import { MenuItemConstructorOptions } from 'electron'; +import type { MenuItemConstructorOptions } from 'electron'; -import { LocaleMessagesType } from '../ts/types/I18N'; +import type { LocaleMessagesType } from '../ts/types/I18N'; export type MenuListType = Array; diff --git a/app/permissions.ts b/app/permissions.ts index ec39bce8e..a5bbda827 100644 --- a/app/permissions.ts +++ b/app/permissions.ts @@ -4,7 +4,7 @@ // The list of permissions is here: // https://electronjs.org/docs/api/session#sessetpermissionrequesthandlerhandler -import { session as ElectronSession } from 'electron'; +import type { session as ElectronSession } from 'electron'; import type { ConfigType } from './base_config'; diff --git a/app/protocol_filter.ts b/app/protocol_filter.ts index acea91bfa..1391d6154 100644 --- a/app/protocol_filter.ts +++ b/app/protocol_filter.ts @@ -1,7 +1,7 @@ // Copyright 2018-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { +import type { protocol as ElectronProtocol, ProtocolRequest, ProtocolResponse, diff --git a/app/spell_check.ts b/app/spell_check.ts index 64a64586e..af68fdc15 100644 --- a/app/spell_check.ts +++ b/app/spell_check.ts @@ -3,15 +3,16 @@ /* eslint-disable strict */ -import { BrowserWindow, Menu, clipboard, nativeImage } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { Menu, clipboard, nativeImage } from 'electron'; import { sync as osLocaleSync } from 'os-locale'; import { uniq } from 'lodash'; import { fileURLToPath } from 'url'; import { maybeParseUrl } from '../ts/util/url'; -import { LocaleMessagesType } from '../ts/types/I18N'; +import type { LocaleMessagesType } from '../ts/types/I18N'; -import { MenuListType } from './menu'; +import type { MenuListType } from './menu'; export function getLanguages( userLocale: string, diff --git a/sticker-creator/app/stages/MetaStage.tsx b/sticker-creator/app/stages/MetaStage.tsx index 4ba4b1293..b938200ad 100644 --- a/sticker-creator/app/stages/MetaStage.tsx +++ b/sticker-creator/app/stages/MetaStage.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { FileWithPath } from 'react-dropzone'; +import type { FileWithPath } from 'react-dropzone'; import { AppStage } from './AppStage'; import * as styles from './MetaStage.scss'; import { processStickerImage } from '../../util/preload'; diff --git a/sticker-creator/components/ConfirmModal.tsx b/sticker-creator/components/ConfirmModal.tsx index 18ca7706a..8cabd28e2 100644 --- a/sticker-creator/components/ConfirmModal.tsx +++ b/sticker-creator/components/ConfirmModal.tsx @@ -4,7 +4,8 @@ import * as React from 'react'; import { createPortal } from 'react-dom'; import * as styles from './ConfirmModal.scss'; -import { ConfirmDialog, Props } from '../elements/ConfirmDialog'; +import type { Props } from '../elements/ConfirmDialog'; +import { ConfirmDialog } from '../elements/ConfirmDialog'; export type Mode = 'removable' | 'pick-emoji' | 'add'; diff --git a/sticker-creator/components/StickerFrame.tsx b/sticker-creator/components/StickerFrame.tsx index 45a5362c8..9a3ea5937 100644 --- a/sticker-creator/components/StickerFrame.tsx +++ b/sticker-creator/components/StickerFrame.tsx @@ -11,14 +11,15 @@ import { Reference as PopperReference, } from 'react-popper'; import { AddEmoji } from '../elements/icons'; -import { DropZone, Props as DropZoneProps } from '../elements/DropZone'; +import type { Props as DropZoneProps } from '../elements/DropZone'; +import { DropZone } from '../elements/DropZone'; import { StickerPreview } from '../elements/StickerPreview'; import * as styles from './StickerFrame.scss'; -import { +import type { EmojiPickDataType, - EmojiPicker, Props as EmojiPickerProps, } from '../../ts/components/emoji/EmojiPicker'; +import { EmojiPicker } from '../../ts/components/emoji/EmojiPicker'; import { Emoji } from '../../ts/components/emoji/Emoji'; import { PopperRootContext } from '../../ts/components/PopperRootContext'; import { useI18n } from '../util/i18n'; diff --git a/sticker-creator/components/StickerGrid.tsx b/sticker-creator/components/StickerGrid.tsx index cabf196d3..03255af9e 100644 --- a/sticker-creator/components/StickerGrid.tsx +++ b/sticker-creator/components/StickerGrid.tsx @@ -3,15 +3,14 @@ import * as React from 'react'; import PQueue from 'p-queue'; -import { - SortableContainer, - SortableElement, - SortEndHandler, -} from 'react-sortable-hoc'; +import type { SortEndHandler } from 'react-sortable-hoc'; +import { SortableContainer, SortableElement } from 'react-sortable-hoc'; import * as styles from './StickerGrid.scss'; -import { Props as StickerFrameProps, StickerFrame } from './StickerFrame'; +import type { Props as StickerFrameProps } from './StickerFrame'; +import { StickerFrame } from './StickerFrame'; import { stickersDuck } from '../store'; -import { DropZone, Props as DropZoneProps } from '../elements/DropZone'; +import type { Props as DropZoneProps } from '../elements/DropZone'; +import { DropZone } from '../elements/DropZone'; import { processStickerImage } from '../util/preload'; import { useI18n } from '../util/i18n'; diff --git a/sticker-creator/elements/DropZone.tsx b/sticker-creator/elements/DropZone.tsx index 1baa3242d..4fb601751 100644 --- a/sticker-creator/elements/DropZone.tsx +++ b/sticker-creator/elements/DropZone.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { FileWithPath } from 'react-dropzone'; +import type { FileWithPath } from 'react-dropzone'; import * as styles from './DropZone.scss'; import { useI18n } from '../util/i18n'; import { useStickerDropzone } from '../util/useStickerDropzone'; diff --git a/sticker-creator/elements/MessageBubble.tsx b/sticker-creator/elements/MessageBubble.tsx index 54a1fe792..8697ad6f0 100644 --- a/sticker-creator/elements/MessageBubble.tsx +++ b/sticker-creator/elements/MessageBubble.tsx @@ -3,7 +3,8 @@ import * as React from 'react'; import * as styles from './MessageBubble.scss'; -import { MessageMeta, Props as MessageMetaProps } from './MessageMeta'; +import type { Props as MessageMetaProps } from './MessageMeta'; +import { MessageMeta } from './MessageMeta'; export type Props = Pick & { children: React.ReactNode; diff --git a/sticker-creator/elements/MessageSticker.tsx b/sticker-creator/elements/MessageSticker.tsx index 30c5cfe42..b3495e48c 100644 --- a/sticker-creator/elements/MessageSticker.tsx +++ b/sticker-creator/elements/MessageSticker.tsx @@ -3,7 +3,8 @@ import * as React from 'react'; import * as styles from './MessageSticker.scss'; -import { MessageMeta, Props as MessageMetaProps } from './MessageMeta'; +import type { Props as MessageMetaProps } from './MessageMeta'; +import { MessageMeta } from './MessageMeta'; export type Props = MessageMetaProps & { image: string; diff --git a/sticker-creator/elements/StickerPreview.tsx b/sticker-creator/elements/StickerPreview.tsx index c2cee2dc0..eedb22430 100644 --- a/sticker-creator/elements/StickerPreview.tsx +++ b/sticker-creator/elements/StickerPreview.tsx @@ -2,11 +2,12 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { PopperArrowProps } from 'react-popper'; -import { Placement } from '@popperjs/core'; +import type { PopperArrowProps } from 'react-popper'; +import type { Placement } from '@popperjs/core'; import * as styles from './StickerPreview.scss'; import { MessageBubble } from './MessageBubble'; -import { MessageSticker, Props as MessageStickerProps } from './MessageSticker'; +import type { Props as MessageStickerProps } from './MessageSticker'; +import { MessageSticker } from './MessageSticker'; import { useI18n } from '../util/i18n'; export type Props = Pick, 'style'> & { diff --git a/sticker-creator/store/ducks/stickers.ts b/sticker-creator/store/ducks/stickers.ts index 47f670d91..42fdf605a 100644 --- a/sticker-creator/store/ducks/stickers.ts +++ b/sticker-creator/store/ducks/stickers.ts @@ -4,26 +4,22 @@ /* eslint-disable no-param-reassign */ import { useMemo } from 'react'; -import { - createAction, - Draft, - handleAction, - reduceReducers, -} from 'redux-ts-utils'; +import type { Draft } from 'redux-ts-utils'; +import { createAction, handleAction, reduceReducers } from 'redux-ts-utils'; import { useDispatch, useSelector } from 'react-redux'; import { createSelector } from 'reselect'; import { clamp, find, isNumber, pull, remove, take, uniq } from 'lodash'; -import { SortEnd } from 'react-sortable-hoc'; +import type { SortEnd } from 'react-sortable-hoc'; import { bindActionCreators } from 'redux'; import arrayMove from 'array-move'; // eslint-disable-next-line import/no-cycle -import { AppState } from '../reducer'; -import { +import type { AppState } from '../reducer'; +import type { PackMetaData, StickerImageData, StickerData, } from '../../util/preload'; -import { EmojiPickDataType } from '../../../ts/components/emoji/EmojiPicker'; +import type { EmojiPickDataType } from '../../../ts/components/emoji/EmojiPicker'; import { convertShortName } from '../../../ts/components/emoji/lib'; export const initializeStickers = createAction>( diff --git a/sticker-creator/store/reducer.ts b/sticker-creator/store/reducer.ts index dd9427dd4..69b6f910f 100644 --- a/sticker-creator/store/reducer.ts +++ b/sticker-creator/store/reducer.ts @@ -1,7 +1,8 @@ // Copyright 2019-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { combineReducers, Reducer } from 'redux'; +import type { Reducer } from 'redux'; +import { combineReducers } from 'redux'; // eslint-disable-next-line import/no-cycle import { reducer as stickers } from './ducks/stickers'; diff --git a/sticker-creator/util/preload.ts b/sticker-creator/util/preload.ts index 5bf272083..38c048346 100644 --- a/sticker-creator/util/preload.ts +++ b/sticker-creator/util/preload.ts @@ -1,7 +1,7 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { Metadata } from 'sharp'; +import type { Metadata } from 'sharp'; declare global { // We want to extend `window`'s properties, so we need an interface. diff --git a/sticker-creator/util/useStickerDropzone.ts b/sticker-creator/util/useStickerDropzone.ts index 390e62537..c68932c92 100644 --- a/sticker-creator/util/useStickerDropzone.ts +++ b/sticker-creator/util/useStickerDropzone.ts @@ -1,7 +1,8 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { useDropzone, DropzoneOptions } from 'react-dropzone'; +import type { DropzoneOptions } from 'react-dropzone'; +import { useDropzone } from 'react-dropzone'; export const useStickerDropzone = ( onDrop: DropzoneOptions['onDrop'] diff --git a/ts/ConversationController.ts b/ts/ConversationController.ts index 549e0f8b5..da4a3906d 100644 --- a/ts/ConversationController.ts +++ b/ts/ConversationController.ts @@ -5,12 +5,12 @@ import { debounce, uniq, without } from 'lodash'; import PQueue from 'p-queue'; import dataInterface from './sql/Client'; -import { +import type { ConversationModelCollectionType, ConversationAttributesType, ConversationAttributesTypeType, } from './model-types.d'; -import { ConversationModel } from './models/conversations'; +import type { ConversationModel } from './models/conversations'; import { maybeDeriveGroupV2Id } from './groups'; import { assert } from './util/assert'; import { isValidGuid } from './util/isValidGuid'; diff --git a/ts/Curve.ts b/ts/Curve.ts index 246d9ef3b..f5067b1e8 100644 --- a/ts/Curve.ts +++ b/ts/Curve.ts @@ -5,7 +5,7 @@ import * as client from '@signalapp/signal-client'; import * as Bytes from './Bytes'; import { constantTimeEqual } from './Crypto'; -import { +import type { KeyPairType, CompatPreKeyType, CompatSignedPreKeyType, diff --git a/ts/LibSignalStores.ts b/ts/LibSignalStores.ts index b7206198b..6b588eb70 100644 --- a/ts/LibSignalStores.ts +++ b/ts/LibSignalStores.ts @@ -6,28 +6,30 @@ import { isNumber } from 'lodash'; -import { +import type { Direction, - IdentityKeyStore, PreKeyRecord, + ProtocolAddress, + SenderKeyRecord, + SessionRecord, + SignedPreKeyRecord, + Uuid, +} from '@signalapp/signal-client'; +import { + IdentityKeyStore, PreKeyStore, PrivateKey, - ProtocolAddress, PublicKey, - SenderKeyRecord, SenderKeyStore, - SessionRecord, SessionStore, - SignedPreKeyRecord, SignedPreKeyStore, - Uuid, } from '@signalapp/signal-client'; import { freezePreKey, freezeSignedPreKey } from './SignalProtocolStore'; import { Address } from './types/Address'; import { QualifiedAddress } from './types/QualifiedAddress'; import type { UUID } from './types/UUID'; -import { Zone } from './util/Zone'; +import type { Zone } from './util/Zone'; function encodeAddress(address: ProtocolAddress): Address { const name = address.name(); diff --git a/ts/SignalProtocolStore.ts b/ts/SignalProtocolStore.ts index 1fa7ea781..f8648f685 100644 --- a/ts/SignalProtocolStore.ts +++ b/ts/SignalProtocolStore.ts @@ -28,7 +28,7 @@ import { sessionRecordToProtobuf, sessionStructureToBytes, } from './util/sessionTranslation'; -import { +import type { DeviceType, IdentityKeyType, IdentityKeyIdType, @@ -48,12 +48,11 @@ import { } from './textsecure/Types.d'; import { getSendOptions } from './util/getSendOptions'; import type { RemoveAllConfiguration } from './types/RemoveAllConfiguration'; -import { UUID, UUIDStringType } from './types/UUID'; -import { Address } from './types/Address'; -import { - QualifiedAddress, - QualifiedAddressStringType, -} from './types/QualifiedAddress'; +import type { UUIDStringType } from './types/UUID'; +import { UUID } from './types/UUID'; +import type { Address } from './types/Address'; +import type { QualifiedAddressStringType } from './types/QualifiedAddress'; +import { QualifiedAddress } from './types/QualifiedAddress'; import * as log from './logging/log'; const TIMESTAMP_THRESHOLD = 5 * 1000; // 5 seconds diff --git a/ts/background.ts b/ts/background.ts index c617468ad..60e58d328 100644 --- a/ts/background.ts +++ b/ts/background.ts @@ -7,19 +7,22 @@ import { bindActionCreators } from 'redux'; import { render, unstable_batchedUpdates as batchedUpdates } from 'react-dom'; import MessageReceiver from './textsecure/MessageReceiver'; -import { SessionResetsType, ProcessedDataMessage } from './textsecure/Types.d'; +import type { + SessionResetsType, + ProcessedDataMessage, +} from './textsecure/Types.d'; import { HTTPError } from './textsecure/Errors'; import { suspendTasksWithTimeout, resumeTasksWithTimeout, } from './textsecure/TaskWithTimeout'; -import { +import type { MessageAttributesType, ConversationAttributesType, } from './model-types.d'; import * as Bytes from './Bytes'; import * as Timers from './Timers'; -import { WhatIsThis, DeliveryReceiptBatcherItemType } from './window.d'; +import type { WhatIsThis, DeliveryReceiptBatcherItemType } from './window.d'; import { getTitleBarVisibility, TitleBarVisibility } from './types/Settings'; import { SocketStatus } from './types/SocketStatus'; import { DEFAULT_CONVERSATION_COLOR } from './types/Colors'; @@ -38,7 +41,7 @@ import * as KeyboardLayout from './services/keyboardLayout'; import { routineProfileRefresh } from './routineProfileRefresh'; import { isMoreRecentThan, isOlderThan, toDayMillis } from './util/timestamp'; import { isValidReactionEmoji } from './reactions/isValidReactionEmoji'; -import { ConversationModel } from './models/conversations'; +import type { ConversationModel } from './models/conversations'; import { getMessageById } from './messages/getMessageById'; import { createBatcher } from './util/batcher'; import { updateConversationsWithUuidLookup } from './updateConversationsWithUuidLookup'; @@ -50,7 +53,7 @@ import { shouldRespondWithProfileKey } from './util/shouldRespondWithProfileKey' import { LatestQueue } from './util/LatestQueue'; import { parseIntOrThrow } from './util/parseIntOrThrow'; import { getProfile } from './util/getProfile'; -import { +import type { ConfigurationEvent, ContactEvent, DecryptionErrorEvent, @@ -71,11 +74,11 @@ import { SentEventData, StickerPackEvent, TypingEvent, - VerifiedEvent, ViewEvent, ViewOnceOpenSyncEvent, ViewSyncEvent, } from './textsecure/messageReceiverEvents'; +import { VerifiedEvent } from './textsecure/messageReceiverEvents'; import type { WebAPIType } from './textsecure/WebAPI'; import * as KeyChangeListener from './textsecure/KeyChangeListener'; import { isDirectConversation, isGroupV2 } from './util/whatTypeOfConversation'; @@ -96,10 +99,8 @@ import { ReadSyncs } from './messageModifiers/ReadSyncs'; import { ViewSyncs } from './messageModifiers/ViewSyncs'; import { ViewOnceOpenSyncs } from './messageModifiers/ViewOnceOpenSyncs'; import { ReadStatus } from './messages/MessageReadStatus'; -import { - SendStateByConversationId, - SendStatus, -} from './messages/MessageSendState'; +import type { SendStateByConversationId } from './messages/MessageSendState'; +import { SendStatus } from './messages/MessageSendState'; import * as AttachmentDownloads from './messageModifiers/AttachmentDownloads'; import * as preferredReactions from './state/ducks/preferredReactions'; import * as Conversation from './types/Conversation'; diff --git a/ts/challenge.ts b/ts/challenge.ts index 958ffe7c3..58f45c1c5 100644 --- a/ts/challenge.ts +++ b/ts/challenge.ts @@ -12,13 +12,13 @@ // are not immediately retried, however, until `.onOnline()` is called from // when we are actually online. -import { MessageModel } from './models/messages'; +import type { MessageModel } from './models/messages'; import { assert } from './util/assert'; import { isNotNil } from './util/isNotNil'; import { isOlderThan } from './util/timestamp'; import { parseRetryAfter } from './util/parseRetryAfter'; import { getEnvironment, Environment } from './environment'; -import { StorageInterface } from './types/Storage.d'; +import type { StorageInterface } from './types/Storage.d'; import { HTTPError } from './textsecure/Errors'; import * as log from './logging/log'; diff --git a/ts/components/About.tsx b/ts/components/About.tsx index 9dd31b4b2..bbe30a5ce 100644 --- a/ts/components/About.tsx +++ b/ts/components/About.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { useEscapeHandling } from '../hooks/useEscapeHandling'; export type PropsType = { diff --git a/ts/components/AddGroupMemberErrorDialog.tsx b/ts/components/AddGroupMemberErrorDialog.tsx index 083d07b70..75bf54610 100644 --- a/ts/components/AddGroupMemberErrorDialog.tsx +++ b/ts/components/AddGroupMemberErrorDialog.tsx @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Alert } from './Alert'; import { Intl } from './Intl'; import { ContactName } from './conversation/ContactName'; diff --git a/ts/components/Alert.tsx b/ts/components/Alert.tsx index dc3bf4bf6..9fb91d48a 100644 --- a/ts/components/Alert.tsx +++ b/ts/components/Alert.tsx @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Button } from './Button'; import { Modal } from './Modal'; diff --git a/ts/components/AnnouncementsOnlyGroupBanner.tsx b/ts/components/AnnouncementsOnlyGroupBanner.tsx index 8658bdbe0..bbe01d4a8 100644 --- a/ts/components/AnnouncementsOnlyGroupBanner.tsx +++ b/ts/components/AnnouncementsOnlyGroupBanner.tsx @@ -2,9 +2,9 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useState } from 'react'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { Intl } from './Intl'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Modal } from './Modal'; import { ConversationListItem } from './conversationList/ConversationListItem'; diff --git a/ts/components/App.tsx b/ts/components/App.tsx index 25eef2eda..20c80978e 100644 --- a/ts/components/App.tsx +++ b/ts/components/App.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ComponentProps, useEffect } from 'react'; +import type { ComponentProps } from 'react'; +import React, { useEffect } from 'react'; import { Globals } from '@react-spring/web'; import classNames from 'classnames'; diff --git a/ts/components/Avatar.stories.tsx b/ts/components/Avatar.stories.tsx index 863baa256..fc779c49e 100644 --- a/ts/components/Avatar.stories.tsx +++ b/ts/components/Avatar.stories.tsx @@ -8,10 +8,12 @@ import { storiesOf } from '@storybook/react'; import { boolean, select, text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { Avatar, AvatarBlur, Props } from './Avatar'; +import type { Props } from './Avatar'; +import { Avatar, AvatarBlur } from './Avatar'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/Avatar.tsx b/ts/components/Avatar.tsx index 25b08fab5..9d87655f4 100644 --- a/ts/components/Avatar.tsx +++ b/ts/components/Avatar.tsx @@ -1,22 +1,21 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { +import type { FunctionComponent, MouseEvent, ReactChild, ReactNode, - useEffect, - useState, } from 'react'; +import React, { useEffect, useState } from 'react'; import classNames from 'classnames'; import { noop } from 'lodash'; import { Spinner } from './Spinner'; import { getInitials } from '../util/getInitials'; -import { LocalizerType } from '../types/Util'; -import { AvatarColorType } from '../types/Colors'; +import type { LocalizerType } from '../types/Util'; +import type { AvatarColorType } from '../types/Colors'; import * as log from '../logging/log'; import { assert } from '../util/assert'; import { shouldBlurAvatar } from '../util/shouldBlurAvatar'; diff --git a/ts/components/AvatarColorPicker.stories.tsx b/ts/components/AvatarColorPicker.stories.tsx index e5085a870..a1a2e90cf 100644 --- a/ts/components/AvatarColorPicker.stories.tsx +++ b/ts/components/AvatarColorPicker.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { AvatarColorPicker, PropsType } from './AvatarColorPicker'; +import type { PropsType } from './AvatarColorPicker'; +import { AvatarColorPicker } from './AvatarColorPicker'; import { AvatarColors } from '../types/Colors'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/AvatarColorPicker.tsx b/ts/components/AvatarColorPicker.tsx index ec4c1f624..888452281 100644 --- a/ts/components/AvatarColorPicker.tsx +++ b/ts/components/AvatarColorPicker.tsx @@ -2,8 +2,9 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; -import { LocalizerType } from '../types/Util'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; +import type { LocalizerType } from '../types/Util'; import { BetterAvatarBubble } from './BetterAvatarBubble'; export type PropsType = { diff --git a/ts/components/AvatarEditor.stories.tsx b/ts/components/AvatarEditor.stories.tsx index 04b77082b..d4c08d553 100644 --- a/ts/components/AvatarEditor.stories.tsx +++ b/ts/components/AvatarEditor.stories.tsx @@ -9,7 +9,8 @@ import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; import { AvatarColors } from '../types/Colors'; -import { AvatarEditor, PropsType } from './AvatarEditor'; +import type { PropsType } from './AvatarEditor'; +import { AvatarEditor } from './AvatarEditor'; import { getDefaultAvatars } from '../types/Avatar'; import { createAvatarData } from '../util/createAvatarData'; diff --git a/ts/components/AvatarEditor.tsx b/ts/components/AvatarEditor.tsx index 839be31a0..dd09ee381 100644 --- a/ts/components/AvatarEditor.tsx +++ b/ts/components/AvatarEditor.tsx @@ -3,8 +3,8 @@ import React, { useCallback, useEffect, useState } from 'react'; -import { AvatarColorType } from '../types/Colors'; -import { +import type { AvatarColorType } from '../types/Colors'; +import type { AvatarDataType, DeleteAvatarFromDiskActionType, ReplaceAvatarActionType, @@ -16,7 +16,7 @@ import { AvatarPreview } from './AvatarPreview'; import { AvatarTextEditor } from './AvatarTextEditor'; import { AvatarUploadButton } from './AvatarUploadButton'; import { BetterAvatar } from './BetterAvatar'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { avatarDataToBytes } from '../util/avatarDataToBytes'; import { createAvatarData } from '../util/createAvatarData'; import { isSameAvatarData } from '../util/isSameAvatarData'; diff --git a/ts/components/AvatarIconEditor.stories.tsx b/ts/components/AvatarIconEditor.stories.tsx index 06cc1219d..fe7db7cef 100644 --- a/ts/components/AvatarIconEditor.stories.tsx +++ b/ts/components/AvatarIconEditor.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { AvatarIconEditor, PropsType } from './AvatarIconEditor'; +import type { PropsType } from './AvatarIconEditor'; +import { AvatarIconEditor } from './AvatarIconEditor'; import { GroupAvatarIcons, PersonalAvatarIcons } from '../types/Avatar'; import { AvatarColors } from '../types/Colors'; import { createAvatarData } from '../util/createAvatarData'; diff --git a/ts/components/AvatarIconEditor.tsx b/ts/components/AvatarIconEditor.tsx index c214b0ce2..bd201b804 100644 --- a/ts/components/AvatarIconEditor.tsx +++ b/ts/components/AvatarIconEditor.tsx @@ -4,11 +4,11 @@ import React, { useCallback, useEffect, useState } from 'react'; import { AvatarColorPicker } from './AvatarColorPicker'; -import { AvatarColorType } from '../types/Colors'; -import { AvatarDataType } from '../types/Avatar'; +import type { AvatarColorType } from '../types/Colors'; +import type { AvatarDataType } from '../types/Avatar'; import { AvatarModalButtons } from './AvatarModalButtons'; import { AvatarPreview } from './AvatarPreview'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { avatarDataToBytes } from '../util/avatarDataToBytes'; export type PropsType = { diff --git a/ts/components/AvatarLightbox.stories.tsx b/ts/components/AvatarLightbox.stories.tsx index 8ef9f10a3..29eaddba8 100644 --- a/ts/components/AvatarLightbox.stories.tsx +++ b/ts/components/AvatarLightbox.stories.tsx @@ -9,7 +9,8 @@ import { select } from '@storybook/addon-knobs'; import enMessages from '../../_locales/en/messages.json'; import { AvatarColors } from '../types/Colors'; -import { AvatarLightbox, PropsType } from './AvatarLightbox'; +import type { PropsType } from './AvatarLightbox'; +import { AvatarLightbox } from './AvatarLightbox'; import { setupI18n } from '../util/setupI18n'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/AvatarLightbox.tsx b/ts/components/AvatarLightbox.tsx index 68ec65022..d1fba0cc5 100644 --- a/ts/components/AvatarLightbox.tsx +++ b/ts/components/AvatarLightbox.tsx @@ -3,10 +3,10 @@ import React from 'react'; -import { AvatarColorType } from '../types/Colors'; +import type { AvatarColorType } from '../types/Colors'; import { AvatarPreview } from './AvatarPreview'; import { Lightbox } from './Lightbox'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { avatarColor?: AvatarColorType; diff --git a/ts/components/AvatarModalButtons.stories.tsx b/ts/components/AvatarModalButtons.stories.tsx index 24d28dea2..aa709c2ef 100644 --- a/ts/components/AvatarModalButtons.stories.tsx +++ b/ts/components/AvatarModalButtons.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import enMessages from '../../_locales/en/messages.json'; -import { AvatarModalButtons, PropsType } from './AvatarModalButtons'; +import type { PropsType } from './AvatarModalButtons'; +import { AvatarModalButtons } from './AvatarModalButtons'; import { setupI18n } from '../util/setupI18n'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/AvatarModalButtons.tsx b/ts/components/AvatarModalButtons.tsx index cbca979aa..a7cd70a96 100644 --- a/ts/components/AvatarModalButtons.tsx +++ b/ts/components/AvatarModalButtons.tsx @@ -5,7 +5,7 @@ import React, { useState } from 'react'; import { Button, ButtonVariant } from './Button'; import { ConfirmDiscardDialog } from './ConfirmDiscardDialog'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Modal } from './Modal'; export type PropsType = { diff --git a/ts/components/AvatarPopup.stories.tsx b/ts/components/AvatarPopup.stories.tsx index 029a7354e..458a03fd4 100644 --- a/ts/components/AvatarPopup.stories.tsx +++ b/ts/components/AvatarPopup.stories.tsx @@ -7,8 +7,10 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { boolean, select, text } from '@storybook/addon-knobs'; -import { AvatarPopup, Props } from './AvatarPopup'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; +import type { Props } from './AvatarPopup'; +import { AvatarPopup } from './AvatarPopup'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/AvatarPopup.tsx b/ts/components/AvatarPopup.tsx index 6a3afe8f8..84616db88 100644 --- a/ts/components/AvatarPopup.tsx +++ b/ts/components/AvatarPopup.tsx @@ -4,10 +4,11 @@ import * as React from 'react'; import classNames from 'classnames'; -import { Avatar, Props as AvatarProps } from './Avatar'; +import type { Props as AvatarProps } from './Avatar'; +import { Avatar } from './Avatar'; import { useRestoreFocus } from '../hooks/useRestoreFocus'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type Props = { readonly i18n: LocalizerType; diff --git a/ts/components/AvatarPreview.stories.tsx b/ts/components/AvatarPreview.stories.tsx index debc7079c..3d11e7670 100644 --- a/ts/components/AvatarPreview.stories.tsx +++ b/ts/components/AvatarPreview.stories.tsx @@ -7,7 +7,8 @@ import { chunk } from 'lodash'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; -import { AvatarPreview, PropsType } from './AvatarPreview'; +import type { PropsType } from './AvatarPreview'; +import { AvatarPreview } from './AvatarPreview'; import { AvatarColors } from '../types/Colors'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/AvatarPreview.tsx b/ts/components/AvatarPreview.tsx index 2c316be75..0daaf8287 100644 --- a/ts/components/AvatarPreview.tsx +++ b/ts/components/AvatarPreview.tsx @@ -1,13 +1,15 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { CSSProperties, useEffect, useRef, useState } from 'react'; +import type { CSSProperties } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { noop } from 'lodash'; import * as log from '../logging/log'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Spinner } from './Spinner'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; import { getInitials } from '../util/getInitials'; import { imagePathToBytes } from '../util/imagePathToBytes'; diff --git a/ts/components/AvatarTextEditor.stories.tsx b/ts/components/AvatarTextEditor.stories.tsx index e33d64291..2c2e0874d 100644 --- a/ts/components/AvatarTextEditor.stories.tsx +++ b/ts/components/AvatarTextEditor.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { AvatarTextEditor, PropsType } from './AvatarTextEditor'; +import type { PropsType } from './AvatarTextEditor'; +import { AvatarTextEditor } from './AvatarTextEditor'; import { AvatarColors } from '../types/Colors'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/AvatarTextEditor.tsx b/ts/components/AvatarTextEditor.tsx index 5b0561687..c42e72c1a 100644 --- a/ts/components/AvatarTextEditor.tsx +++ b/ts/components/AvatarTextEditor.tsx @@ -1,9 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { ChangeEvent, ClipboardEvent } from 'react'; import React, { - ChangeEvent, - ClipboardEvent, useCallback, useEffect, useMemo, @@ -15,10 +14,10 @@ import { noop } from 'lodash'; import * as grapheme from '../util/grapheme'; import { AvatarColorPicker } from './AvatarColorPicker'; import { AvatarColors } from '../types/Colors'; -import { AvatarDataType } from '../types/Avatar'; +import type { AvatarDataType } from '../types/Avatar'; import { AvatarModalButtons } from './AvatarModalButtons'; import { BetterAvatarBubble } from './BetterAvatarBubble'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { avatarDataToBytes } from '../util/avatarDataToBytes'; import { createAvatarData } from '../util/createAvatarData'; import { diff --git a/ts/components/AvatarUploadButton.stories.tsx b/ts/components/AvatarUploadButton.stories.tsx index 0c9a2fa06..96bfc0216 100644 --- a/ts/components/AvatarUploadButton.stories.tsx +++ b/ts/components/AvatarUploadButton.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { AvatarUploadButton, PropsType } from './AvatarUploadButton'; +import type { PropsType } from './AvatarUploadButton'; +import { AvatarUploadButton } from './AvatarUploadButton'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/AvatarUploadButton.tsx b/ts/components/AvatarUploadButton.tsx index 252c5d1fb..fd18b165f 100644 --- a/ts/components/AvatarUploadButton.tsx +++ b/ts/components/AvatarUploadButton.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ChangeEventHandler, useEffect, useRef, useState } from 'react'; +import type { ChangeEventHandler } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import { noop } from 'lodash'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { processImageFile } from '../util/processImageFile'; export type PropsType = { diff --git a/ts/components/BackboneHost.tsx b/ts/components/BackboneHost.tsx index 8dfc67216..aae61b0ec 100644 --- a/ts/components/BackboneHost.tsx +++ b/ts/components/BackboneHost.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useEffect, useRef } from 'react'; -import * as Backbone from 'backbone'; +import type * as Backbone from 'backbone'; type PropsType = { View: typeof Backbone.View; diff --git a/ts/components/BetterAvatar.stories.tsx b/ts/components/BetterAvatar.stories.tsx index 8682a74d0..8cc172bb3 100644 --- a/ts/components/BetterAvatar.stories.tsx +++ b/ts/components/BetterAvatar.stories.tsx @@ -9,7 +9,8 @@ import { action } from '@storybook/addon-actions'; import enMessages from '../../_locales/en/messages.json'; import { AvatarColors } from '../types/Colors'; import { GroupAvatarIcons, PersonalAvatarIcons } from '../types/Avatar'; -import { BetterAvatar, PropsType } from './BetterAvatar'; +import type { PropsType } from './BetterAvatar'; +import { BetterAvatar } from './BetterAvatar'; import { createAvatarData } from '../util/createAvatarData'; import { setupI18n } from '../util/setupI18n'; diff --git a/ts/components/BetterAvatar.tsx b/ts/components/BetterAvatar.tsx index 10c353129..43dc1a280 100644 --- a/ts/components/BetterAvatar.tsx +++ b/ts/components/BetterAvatar.tsx @@ -1,11 +1,12 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { MouseEvent, useEffect, useState } from 'react'; +import type { MouseEvent } from 'react'; +import React, { useEffect, useState } from 'react'; import { noop } from 'lodash'; -import { AvatarDataType } from '../types/Avatar'; +import type { AvatarDataType } from '../types/Avatar'; import { BetterAvatarBubble } from './BetterAvatarBubble'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Spinner } from './Spinner'; import { avatarDataToBytes } from '../util/avatarDataToBytes'; diff --git a/ts/components/BetterAvatarBubble.stories.tsx b/ts/components/BetterAvatarBubble.stories.tsx index 625561353..36a7da84d 100644 --- a/ts/components/BetterAvatarBubble.stories.tsx +++ b/ts/components/BetterAvatarBubble.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import enMessages from '../../_locales/en/messages.json'; import { AvatarColors } from '../types/Colors'; -import { BetterAvatarBubble, PropsType } from './BetterAvatarBubble'; +import type { PropsType } from './BetterAvatarBubble'; +import { BetterAvatarBubble } from './BetterAvatarBubble'; import { setupI18n } from '../util/setupI18n'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/BetterAvatarBubble.tsx b/ts/components/BetterAvatarBubble.tsx index e8b490310..296d3665c 100644 --- a/ts/components/BetterAvatarBubble.tsx +++ b/ts/components/BetterAvatarBubble.tsx @@ -1,11 +1,12 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { CSSProperties, MouseEvent, ReactNode } from 'react'; +import type { CSSProperties, MouseEvent, ReactNode } from 'react'; +import React from 'react'; import classNames from 'classnames'; -import { AvatarColorType } from '../types/Colors'; -import { LocalizerType } from '../types/Util'; +import type { AvatarColorType } from '../types/Colors'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { children?: ReactNode; diff --git a/ts/components/Button.tsx b/ts/components/Button.tsx index c1ae3395b..4c091b767 100644 --- a/ts/components/Button.tsx +++ b/ts/components/Button.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { CSSProperties, MouseEventHandler, ReactNode } from 'react'; +import type { CSSProperties, MouseEventHandler, ReactNode } from 'react'; +import React from 'react'; import classNames from 'classnames'; import { assert } from '../util/assert'; diff --git a/ts/components/CallBackgroundBlur.tsx b/ts/components/CallBackgroundBlur.tsx index 11333fe3a..63bb60d03 100644 --- a/ts/components/CallBackgroundBlur.tsx +++ b/ts/components/CallBackgroundBlur.tsx @@ -3,7 +3,7 @@ import React from 'react'; import classNames from 'classnames'; -import { AvatarColorType } from '../types/Colors'; +import type { AvatarColorType } from '../types/Colors'; export type PropsType = { avatarPath?: string; diff --git a/ts/components/CallManager.stories.tsx b/ts/components/CallManager.stories.tsx index 3706a6ac5..cd2e84aae 100644 --- a/ts/components/CallManager.stories.tsx +++ b/ts/components/CallManager.stories.tsx @@ -6,7 +6,8 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { boolean, select, text } from '@storybook/addon-knobs'; -import { CallManager, PropsType } from './CallManager'; +import type { PropsType } from './CallManager'; +import { CallManager } from './CallManager'; import { CallEndedReason, CallMode, @@ -14,12 +15,13 @@ import { GroupCallConnectionState, GroupCallJoinState, } from '../types/Calling'; -import { ConversationTypeType } from '../state/ducks/conversations'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; +import type { ConversationTypeType } from '../state/ducks/conversations'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { fakeGetGroupCallVideoFrameSource } from '../test-both/helpers/fakeGetGroupCallVideoFrameSource'; import { setupI18n } from '../util/setupI18n'; -import { Props as SafetyNumberViewerProps } from '../state/smart/SafetyNumberViewer'; +import type { Props as SafetyNumberViewerProps } from '../state/smart/SafetyNumberViewer'; import enMessages from '../../_locales/en/messages.json'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/CallManager.tsx b/ts/components/CallManager.tsx index b57691ef1..76113bfa8 100644 --- a/ts/components/CallManager.tsx +++ b/ts/components/CallManager.tsx @@ -11,22 +11,22 @@ import { CallingParticipantsList } from './CallingParticipantsList'; import { CallingSelectPresentingSourcesModal } from './CallingSelectPresentingSourcesModal'; import { CallingPip } from './CallingPip'; import { IncomingCallBar } from './IncomingCallBar'; -import { - SafetyNumberChangeDialog, - SafetyNumberProps, -} from './SafetyNumberChangeDialog'; -import { +import type { SafetyNumberProps } from './SafetyNumberChangeDialog'; +import { SafetyNumberChangeDialog } from './SafetyNumberChangeDialog'; +import type { ActiveCallType, + GroupCallVideoRequest, + PresentedSource, +} from '../types/Calling'; +import { CallEndedReason, CallMode, CallState, GroupCallConnectionState, GroupCallJoinState, - GroupCallVideoRequest, - PresentedSource, } from '../types/Calling'; -import { ConversationType } from '../state/ducks/conversations'; -import { +import type { ConversationType } from '../state/ducks/conversations'; +import type { AcceptCallType, CancelCallType, DeclineCallType, @@ -39,7 +39,7 @@ import { SetRendererCanvasType, StartCallType, } from '../state/ducks/calling'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { missingCaseError } from '../util/missingCaseError'; const GROUP_CALL_RING_DURATION = 60 * 1000; diff --git a/ts/components/CallNeedPermissionScreen.tsx b/ts/components/CallNeedPermissionScreen.tsx index 799e2ca59..48e9b74a8 100644 --- a/ts/components/CallNeedPermissionScreen.tsx +++ b/ts/components/CallNeedPermissionScreen.tsx @@ -2,12 +2,12 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useRef, useEffect } from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { AvatarColors } from '../types/Colors'; import { Avatar } from './Avatar'; import { Intl } from './Intl'; import { ContactName } from './conversation/ContactName'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; type Props = { conversation: Pick< diff --git a/ts/components/CallScreen.stories.tsx b/ts/components/CallScreen.stories.tsx index b9fdfd5ce..9b34d2c89 100644 --- a/ts/components/CallScreen.stories.tsx +++ b/ts/components/CallScreen.stories.tsx @@ -8,16 +8,17 @@ import { storiesOf } from '@storybook/react'; import { boolean, select, number } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; +import type { GroupCallRemoteParticipantType } from '../types/Calling'; import { CallMode, CallState, GroupCallConnectionState, GroupCallJoinState, - GroupCallRemoteParticipantType, } from '../types/Calling'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { AvatarColors } from '../types/Colors'; -import { CallScreen, PropsType } from './CallScreen'; +import type { PropsType } from './CallScreen'; +import { CallScreen } from './CallScreen'; import { setupI18n } from '../util/setupI18n'; import { missingCaseError } from '../util/missingCaseError'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index 8514917e1..867ad5475 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -1,17 +1,12 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - ReactNode, - useState, - useRef, - useEffect, - useCallback, -} from 'react'; +import type { ReactNode } from 'react'; +import React, { useState, useRef, useEffect, useCallback } from 'react'; import { noop } from 'lodash'; import classNames from 'classnames'; import type { VideoFrameSource } from 'ringrtc'; -import { +import type { HangUpType, SetLocalAudioType, SetLocalPreviewType, @@ -23,21 +18,24 @@ import { CallingHeader } from './CallingHeader'; import { CallingPreCallInfo, RingMode } from './CallingPreCallInfo'; import { CallingButton, CallingButtonType } from './CallingButton'; import { CallBackgroundBlur } from './CallBackgroundBlur'; -import { +import type { ActiveCallType, + GroupCallVideoRequest, + PresentedSource, +} from '../types/Calling'; +import { CallMode, CallState, GroupCallConnectionState, GroupCallJoinState, - GroupCallVideoRequest, - PresentedSource, } from '../types/Calling'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; import type { ConversationType } from '../state/ducks/conversations'; import { CallingToastManager } from './CallingToastManager'; import { DirectCallRemoteParticipant } from './DirectCallRemoteParticipant'; import { GroupCallRemoteParticipants } from './GroupCallRemoteParticipants'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { NeedsScreenRecordingPermissionsModal } from './NeedsScreenRecordingPermissionsModal'; import { missingCaseError } from '../util/missingCaseError'; import * as KeyboardLayout from '../services/keyboardLayout'; diff --git a/ts/components/CallingButton.stories.tsx b/ts/components/CallingButton.stories.tsx index 47cb681c0..722bc012d 100644 --- a/ts/components/CallingButton.stories.tsx +++ b/ts/components/CallingButton.stories.tsx @@ -6,7 +6,8 @@ import { storiesOf } from '@storybook/react'; import { select } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { CallingButton, CallingButtonType, PropsType } from './CallingButton'; +import type { PropsType } from './CallingButton'; +import { CallingButton, CallingButtonType } from './CallingButton'; import { TooltipPlacement } from './Tooltip'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CallingButton.tsx b/ts/components/CallingButton.tsx index 33e4871cc..ea8e2d4b6 100644 --- a/ts/components/CallingButton.tsx +++ b/ts/components/CallingButton.tsx @@ -4,9 +4,10 @@ import React, { useMemo } from 'react'; import classNames from 'classnames'; import { v4 as uuid } from 'uuid'; -import { Tooltip, TooltipPlacement } from './Tooltip'; +import type { TooltipPlacement } from './Tooltip'; +import { Tooltip } from './Tooltip'; import { Theme } from '../util/theme'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export enum CallingButtonType { AUDIO_DISABLED = 'AUDIO_DISABLED', diff --git a/ts/components/CallingDeviceSelection.stories.tsx b/ts/components/CallingDeviceSelection.stories.tsx index dae62b60b..a411f030d 100644 --- a/ts/components/CallingDeviceSelection.stories.tsx +++ b/ts/components/CallingDeviceSelection.stories.tsx @@ -5,7 +5,8 @@ import * as React from 'react'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; -import { CallingDeviceSelection, Props } from './CallingDeviceSelection'; +import type { Props } from './CallingDeviceSelection'; +import { CallingDeviceSelection } from './CallingDeviceSelection'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CallingDeviceSelection.tsx b/ts/components/CallingDeviceSelection.tsx index 5ec887ee0..700dcce89 100644 --- a/ts/components/CallingDeviceSelection.tsx +++ b/ts/components/CallingDeviceSelection.tsx @@ -5,12 +5,12 @@ import * as React from 'react'; import type { AudioDevice } from 'ringrtc'; import { Modal } from './Modal'; -import { LocalizerType } from '../types/Util'; -import { - CallingDeviceType, +import type { LocalizerType } from '../types/Util'; +import type { ChangeIODevicePayloadType, MediaDeviceSettings, } from '../types/Calling'; +import { CallingDeviceType } from '../types/Calling'; import { Theme } from '../util/theme'; export type Props = MediaDeviceSettings & { diff --git a/ts/components/CallingHeader.stories.tsx b/ts/components/CallingHeader.stories.tsx index 0cec05840..f4bd7de26 100644 --- a/ts/components/CallingHeader.stories.tsx +++ b/ts/components/CallingHeader.stories.tsx @@ -6,7 +6,8 @@ import { storiesOf } from '@storybook/react'; import { boolean, number } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { CallingHeader, PropsType } from './CallingHeader'; +import type { PropsType } from './CallingHeader'; +import { CallingHeader } from './CallingHeader'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CallingHeader.tsx b/ts/components/CallingHeader.tsx index abdcc9985..734660b96 100644 --- a/ts/components/CallingHeader.tsx +++ b/ts/components/CallingHeader.tsx @@ -1,9 +1,10 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Tooltip } from './Tooltip'; import { Theme } from '../util/theme'; diff --git a/ts/components/CallingLobby.stories.tsx b/ts/components/CallingLobby.stories.tsx index 8d5b399e4..95903e401 100644 --- a/ts/components/CallingLobby.stories.tsx +++ b/ts/components/CallingLobby.stories.tsx @@ -9,8 +9,9 @@ import { action } from '@storybook/addon-actions'; import { v4 as generateUuid } from 'uuid'; import { AvatarColors } from '../types/Colors'; -import { ConversationType } from '../state/ducks/conversations'; -import { CallingLobby, PropsType } from './CallingLobby'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { PropsType } from './CallingLobby'; +import { CallingLobby } from './CallingLobby'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/CallingLobby.tsx b/ts/components/CallingLobby.tsx index f5d47b30f..4882855e3 100644 --- a/ts/components/CallingLobby.tsx +++ b/ts/components/CallingLobby.tsx @@ -3,7 +3,7 @@ import React from 'react'; import classNames from 'classnames'; -import { +import type { SetLocalAudioType, SetLocalPreviewType, SetLocalVideoType, @@ -17,11 +17,11 @@ import { CallingLobbyJoinButton, CallingLobbyJoinButtonVariant, } from './CallingLobbyJoinButton'; -import { AvatarColorType } from '../types/Colors'; -import { LocalizerType } from '../types/Util'; +import type { AvatarColorType } from '../types/Colors'; +import type { LocalizerType } from '../types/Util'; import { useIsOnline } from '../hooks/useIsOnline'; import * as KeyboardLayout from '../services/keyboardLayout'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { isConversationTooBigToRing } from '../conversations/isConversationTooBigToRing'; export type PropsType = { diff --git a/ts/components/CallingLobbyJoinButton.tsx b/ts/components/CallingLobbyJoinButton.tsx index 6f2eca201..3ef985ff9 100644 --- a/ts/components/CallingLobbyJoinButton.tsx +++ b/ts/components/CallingLobbyJoinButton.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactChild, useState } from 'react'; +import type { FunctionComponent, ReactChild } from 'react'; +import React, { useState } from 'react'; import { noop } from 'lodash'; import type { LocalizerType } from '../types/Util'; diff --git a/ts/components/CallingParticipantsList.stories.tsx b/ts/components/CallingParticipantsList.stories.tsx index b0346007b..abe9ad956 100644 --- a/ts/components/CallingParticipantsList.stories.tsx +++ b/ts/components/CallingParticipantsList.stories.tsx @@ -7,9 +7,10 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { v4 as generateUuid } from 'uuid'; -import { CallingParticipantsList, PropsType } from './CallingParticipantsList'; +import type { PropsType } from './CallingParticipantsList'; +import { CallingParticipantsList } from './CallingParticipantsList'; import { AvatarColors } from '../types/Colors'; -import { GroupCallRemoteParticipantType } from '../types/Calling'; +import type { GroupCallRemoteParticipantType } from '../types/Calling'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CallingParticipantsList.tsx b/ts/components/CallingParticipantsList.tsx index db246cd30..b13c84d80 100644 --- a/ts/components/CallingParticipantsList.tsx +++ b/ts/components/CallingParticipantsList.tsx @@ -8,9 +8,9 @@ import { createPortal } from 'react-dom'; import { Avatar } from './Avatar'; import { ContactName } from './conversation/ContactName'; import { InContactsIcon } from './InContactsIcon'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { sortByTitle } from '../util/sortByTitle'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { isInSystemContacts } from '../util/isInSystemContacts'; type ParticipantType = ConversationType & { diff --git a/ts/components/CallingPip.stories.tsx b/ts/components/CallingPip.stories.tsx index 708b4ea54..b36bf924a 100644 --- a/ts/components/CallingPip.stories.tsx +++ b/ts/components/CallingPip.stories.tsx @@ -8,10 +8,11 @@ import { boolean } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; import { AvatarColors } from '../types/Colors'; -import { ConversationType } from '../state/ducks/conversations'; -import { CallingPip, PropsType } from './CallingPip'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { PropsType } from './CallingPip'; +import { CallingPip } from './CallingPip'; +import type { ActiveCallType } from '../types/Calling'; import { - ActiveCallType, CallMode, CallState, GroupCallConnectionState, diff --git a/ts/components/CallingPip.tsx b/ts/components/CallingPip.tsx index 2a4e78b6d..800790059 100644 --- a/ts/components/CallingPip.tsx +++ b/ts/components/CallingPip.tsx @@ -5,9 +5,9 @@ import React from 'react'; import { minBy, debounce, noop } from 'lodash'; import type { VideoFrameSource } from 'ringrtc'; import { CallingPipRemoteVideo } from './CallingPipRemoteVideo'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import type { ActiveCallType, GroupCallVideoRequest } from '../types/Calling'; -import { +import type { HangUpType, SetLocalPreviewType, SetRendererCanvasType, diff --git a/ts/components/CallingPipRemoteVideo.tsx b/ts/components/CallingPipRemoteVideo.tsx index 7469af49b..af50f3624 100644 --- a/ts/components/CallingPipRemoteVideo.tsx +++ b/ts/components/CallingPipRemoteVideo.tsx @@ -8,15 +8,15 @@ import { Avatar } from './Avatar'; import { CallBackgroundBlur } from './CallBackgroundBlur'; import { DirectCallRemoteParticipant } from './DirectCallRemoteParticipant'; import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant'; -import { LocalizerType } from '../types/Util'; -import { +import type { LocalizerType } from '../types/Util'; +import type { ActiveCallType, - CallMode, GroupCallRemoteParticipantType, GroupCallVideoRequest, } from '../types/Calling'; +import { CallMode } from '../types/Calling'; import { AvatarColors } from '../types/Colors'; -import { SetRendererCanvasType } from '../state/ducks/calling'; +import type { SetRendererCanvasType } from '../state/ducks/calling'; import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer'; import { usePageVisibility } from '../hooks/usePageVisibility'; import { missingCaseError } from '../util/missingCaseError'; diff --git a/ts/components/CallingPreCallInfo.tsx b/ts/components/CallingPreCallInfo.tsx index d30e8d3ff..e73620320 100644 --- a/ts/components/CallingPreCallInfo.tsx +++ b/ts/components/CallingPreCallInfo.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; import type { ConversationType } from '../state/ducks/conversations'; import type { LocalizerType } from '../types/Util'; import { Avatar, AvatarSize } from './Avatar'; diff --git a/ts/components/CallingScreenSharingController.stories.tsx b/ts/components/CallingScreenSharingController.stories.tsx index 6ccf73d63..32176982a 100644 --- a/ts/components/CallingScreenSharingController.stories.tsx +++ b/ts/components/CallingScreenSharingController.stories.tsx @@ -5,10 +5,8 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; -import { - CallingScreenSharingController, - PropsType, -} from './CallingScreenSharingController'; +import type { PropsType } from './CallingScreenSharingController'; +import { CallingScreenSharingController } from './CallingScreenSharingController'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CallingScreenSharingController.tsx b/ts/components/CallingScreenSharingController.tsx index bc1edea70..ac1cce259 100644 --- a/ts/components/CallingScreenSharingController.tsx +++ b/ts/components/CallingScreenSharingController.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { Button, ButtonVariant } from './Button'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/CallingSelectPresentingSourcesModal.stories.tsx b/ts/components/CallingSelectPresentingSourcesModal.stories.tsx index 30bdd5300..ea2da276a 100644 --- a/ts/components/CallingSelectPresentingSourcesModal.stories.tsx +++ b/ts/components/CallingSelectPresentingSourcesModal.stories.tsx @@ -5,10 +5,8 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; -import { - CallingSelectPresentingSourcesModal, - PropsType, -} from './CallingSelectPresentingSourcesModal'; +import type { PropsType } from './CallingSelectPresentingSourcesModal'; +import { CallingSelectPresentingSourcesModal } from './CallingSelectPresentingSourcesModal'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CallingSelectPresentingSourcesModal.tsx b/ts/components/CallingSelectPresentingSourcesModal.tsx index f4f5acade..28b7d25a0 100644 --- a/ts/components/CallingSelectPresentingSourcesModal.tsx +++ b/ts/components/CallingSelectPresentingSourcesModal.tsx @@ -5,9 +5,9 @@ import React, { useState } from 'react'; import classNames from 'classnames'; import { groupBy } from 'lodash'; import { Button, ButtonVariant } from './Button'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Modal } from './Modal'; -import { PresentedSource, PresentableSource } from '../types/Calling'; +import type { PresentedSource, PresentableSource } from '../types/Calling'; import { Theme } from '../util/theme'; export type PropsType = { diff --git a/ts/components/CallingToastManager.tsx b/ts/components/CallingToastManager.tsx index 63af47cb4..628878dc9 100644 --- a/ts/components/CallingToastManager.tsx +++ b/ts/components/CallingToastManager.tsx @@ -3,13 +3,10 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'; import classNames from 'classnames'; -import { - ActiveCallType, - CallMode, - GroupCallConnectionState, -} from '../types/Calling'; -import { ConversationType } from '../state/ducks/conversations'; -import { LocalizerType } from '../types/Util'; +import type { ActiveCallType } from '../types/Calling'; +import { CallMode, GroupCallConnectionState } from '../types/Calling'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; type PropsType = { activeCall: ActiveCallType; diff --git a/ts/components/CaptchaDialog.tsx b/ts/components/CaptchaDialog.tsx index 86bb9c537..9d73dd1c3 100644 --- a/ts/components/CaptchaDialog.tsx +++ b/ts/components/CaptchaDialog.tsx @@ -3,7 +3,7 @@ import React, { useRef, useState } from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Button, ButtonVariant } from './Button'; import { Modal } from './Modal'; import { Spinner } from './Spinner'; diff --git a/ts/components/CaptionEditor.stories.tsx b/ts/components/CaptionEditor.stories.tsx index 75f353d4c..61a455d31 100644 --- a/ts/components/CaptionEditor.stories.tsx +++ b/ts/components/CaptionEditor.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { CaptionEditor, Props } from './CaptionEditor'; +import type { Props } from './CaptionEditor'; +import { CaptionEditor } from './CaptionEditor'; import { AUDIO_MP3, IMAGE_JPEG, VIDEO_MP4 } from '../types/MIME'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CaptionEditor.tsx b/ts/components/CaptionEditor.tsx index 4fc4b1c79..938187439 100644 --- a/ts/components/CaptionEditor.tsx +++ b/ts/components/CaptionEditor.tsx @@ -4,9 +4,9 @@ import React from 'react'; import * as GoogleChrome from '../util/GoogleChrome'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type Props = { attachment: AttachmentType; diff --git a/ts/components/ChatColorPicker.stories.tsx b/ts/components/ChatColorPicker.stories.tsx index 05c8af28a..eb2df8c20 100644 --- a/ts/components/ChatColorPicker.stories.tsx +++ b/ts/components/ChatColorPicker.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { select } from '@storybook/addon-knobs'; import enMessages from '../../_locales/en/messages.json'; -import { ChatColorPicker, PropsType } from './ChatColorPicker'; +import type { PropsType } from './ChatColorPicker'; +import { ChatColorPicker } from './ChatColorPicker'; import { ConversationColors } from '../types/Colors'; import { setupI18n } from '../util/setupI18n'; diff --git a/ts/components/ChatColorPicker.tsx b/ts/components/ChatColorPicker.tsx index 0853732c5..4ed87c496 100644 --- a/ts/components/ChatColorPicker.tsx +++ b/ts/components/ChatColorPicker.tsx @@ -1,19 +1,17 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { KeyboardEvent, MouseEvent, useRef, useState } from 'react'; +import type { KeyboardEvent, MouseEvent } from 'react'; +import React, { useRef, useState } from 'react'; import classNames from 'classnames'; import { ContextMenu, ContextMenuTrigger, MenuItem } from 'react-contextmenu'; import { ConfirmationDialog } from './ConfirmationDialog'; import { CustomColorEditor } from './CustomColorEditor'; import { Modal } from './Modal'; -import { - ConversationColors, - ConversationColorType, - CustomColorType, -} from '../types/Colors'; -import { ConversationType } from '../state/ducks/conversations'; -import { LocalizerType } from '../types/Util'; +import type { ConversationColorType, CustomColorType } from '../types/Colors'; +import { ConversationColors } from '../types/Colors'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; import { SampleMessageBubbles } from './SampleMessageBubbles'; import { PanelRow } from './conversation/conversation-details/PanelRow'; import { getCustomColorStyle } from '../util/getCustomColorStyle'; diff --git a/ts/components/Checkbox.stories.tsx b/ts/components/Checkbox.stories.tsx index cb8d9899e..af7db7fec 100644 --- a/ts/components/Checkbox.stories.tsx +++ b/ts/components/Checkbox.stories.tsx @@ -5,7 +5,8 @@ import React from 'react'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; -import { Checkbox, PropsType } from './Checkbox'; +import type { PropsType } from './Checkbox'; +import { Checkbox } from './Checkbox'; const createProps = (): PropsType => ({ checked: false, diff --git a/ts/components/ClearingData.tsx b/ts/components/ClearingData.tsx index 685b14781..e05b43ffc 100644 --- a/ts/components/ClearingData.tsx +++ b/ts/components/ClearingData.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useEffect } from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { deleteAllData: () => void; diff --git a/ts/components/CompositionArea.stories.tsx b/ts/components/CompositionArea.stories.tsx index 4f089c88f..dabbcc27a 100644 --- a/ts/components/CompositionArea.stories.tsx +++ b/ts/components/CompositionArea.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { boolean } from '@storybook/addon-knobs'; import { IMAGE_JPEG } from '../types/MIME'; -import { CompositionArea, Props } from './CompositionArea'; +import type { Props } from './CompositionArea'; +import { CompositionArea } from './CompositionArea'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CompositionArea.tsx b/ts/components/CompositionArea.tsx index acc74335a..7804ee340 100644 --- a/ts/components/CompositionArea.tsx +++ b/ts/components/CompositionArea.tsx @@ -1,53 +1,47 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - MutableRefObject, - useCallback, - useEffect, - useRef, - useState, -} from 'react'; +import type { MutableRefObject } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import { get } from 'lodash'; import classNames from 'classnames'; -import type { BodyRangeType, BodyRangesType } from '../types/Util'; +import type { + BodyRangeType, + BodyRangesType, + LocalizerType, +} from '../types/Util'; import type { ErrorDialogAudioRecorderType } from '../state/ducks/audioRecorder'; import type { HandleAttachmentsProcessingArgsType } from '../util/handleAttachmentsProcessing'; import { Spinner } from './Spinner'; -import { EmojiButton, Props as EmojiButtonProps } from './emoji/EmojiButton'; -import { - Props as StickerButtonProps, - StickerButton, -} from './stickers/StickerButton'; -import { - CompositionInput, +import type { Props as EmojiButtonProps } from './emoji/EmojiButton'; +import { EmojiButton } from './emoji/EmojiButton'; +import type { Props as StickerButtonProps } from './stickers/StickerButton'; +import { StickerButton } from './stickers/StickerButton'; +import type { InputApi, Props as CompositionInputProps, } from './CompositionInput'; -import { - MessageRequestActions, - Props as MessageRequestActionsProps, -} from './conversation/MessageRequestActions'; -import { - GroupV1DisabledActions, - PropsType as GroupV1DisabledActionsPropsType, -} from './conversation/GroupV1DisabledActions'; -import { - GroupV2PendingApprovalActions, - PropsType as GroupV2PendingApprovalActionsPropsType, -} from './conversation/GroupV2PendingApprovalActions'; +import { CompositionInput } from './CompositionInput'; +import type { Props as MessageRequestActionsProps } from './conversation/MessageRequestActions'; +import { MessageRequestActions } from './conversation/MessageRequestActions'; +import type { PropsType as GroupV1DisabledActionsPropsType } from './conversation/GroupV1DisabledActions'; +import { GroupV1DisabledActions } from './conversation/GroupV1DisabledActions'; +import type { PropsType as GroupV2PendingApprovalActionsPropsType } from './conversation/GroupV2PendingApprovalActions'; +import { GroupV2PendingApprovalActions } from './conversation/GroupV2PendingApprovalActions'; import { AnnouncementsOnlyGroupBanner } from './AnnouncementsOnlyGroupBanner'; import { AttachmentList } from './conversation/AttachmentList'; -import { AttachmentType, isImageAttachment } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; +import { isImageAttachment } from '../types/Attachment'; import { AudioCapture } from './conversation/AudioCapture'; import { CompositionUpload } from './CompositionUpload'; -import { ConversationType } from '../state/ducks/conversations'; -import { EmojiPickDataType } from './emoji/EmojiPicker'; -import { LinkPreviewWithDomain } from '../types/LinkPreview'; -import { LocalizerType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { EmojiPickDataType } from './emoji/EmojiPicker'; +import type { LinkPreviewWithDomain } from '../types/LinkPreview'; + import { MandatoryProfileSharingActions } from './conversation/MandatoryProfileSharingActions'; import { MediaQualitySelector } from './MediaQualitySelector'; -import { Quote, Props as QuoteProps } from './conversation/Quote'; +import type { Props as QuoteProps } from './conversation/Quote'; +import { Quote } from './conversation/Quote'; import { StagedLinkPreview } from './conversation/StagedLinkPreview'; import { countStickers } from './stickers/lib'; import { diff --git a/ts/components/CompositionInput.stories.tsx b/ts/components/CompositionInput.stories.tsx index c1202ce8f..374198d03 100644 --- a/ts/components/CompositionInput.stories.tsx +++ b/ts/components/CompositionInput.stories.tsx @@ -9,7 +9,8 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; -import { CompositionInput, Props } from './CompositionInput'; +import type { Props } from './CompositionInput'; +import { CompositionInput } from './CompositionInput'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/CompositionInput.tsx b/ts/components/CompositionInput.tsx index d58ef0a14..cc419df89 100644 --- a/ts/components/CompositionInput.tsx +++ b/ts/components/CompositionInput.tsx @@ -7,14 +7,15 @@ import Delta from 'quill-delta'; import ReactQuill from 'react-quill'; import classNames from 'classnames'; import { Manager, Reference } from 'react-popper'; -import Quill, { KeyboardStatic, RangeStatic } from 'quill'; +import type { KeyboardStatic, RangeStatic } from 'quill'; +import Quill from 'quill'; import { MentionCompletion } from '../quill/mentions/completion'; import { EmojiBlot, EmojiCompletion } from '../quill/emoji'; -import { EmojiPickDataType } from './emoji/EmojiPicker'; +import type { EmojiPickDataType } from './emoji/EmojiPicker'; import { convertShortName } from './emoji/lib'; -import { LocalizerType, BodyRangeType } from '../types/Util'; -import { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType, BodyRangeType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; import { MentionBlot } from '../quill/mentions/blot'; import { matchEmojiImage, diff --git a/ts/components/CompositionUpload.tsx b/ts/components/CompositionUpload.tsx index 182c85048..1a69d6658 100644 --- a/ts/components/CompositionUpload.tsx +++ b/ts/components/CompositionUpload.tsx @@ -1,11 +1,12 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ChangeEventHandler, forwardRef, useState } from 'react'; +import type { ChangeEventHandler } from 'react'; +import React, { forwardRef, useState } from 'react'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; import { AttachmentToastType } from '../types/AttachmentToastType'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { ToastCannotMixImageAndNonImageAttachments } from './ToastCannotMixImageAndNonImageAttachments'; import { ToastDangerousFileType } from './ToastDangerousFileType'; diff --git a/ts/components/ConfirmDiscardDialog.stories.tsx b/ts/components/ConfirmDiscardDialog.stories.tsx index 1063b4fe0..0e6f50858 100644 --- a/ts/components/ConfirmDiscardDialog.stories.tsx +++ b/ts/components/ConfirmDiscardDialog.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { ConfirmDiscardDialog, PropsType } from './ConfirmDiscardDialog'; +import type { PropsType } from './ConfirmDiscardDialog'; +import { ConfirmDiscardDialog } from './ConfirmDiscardDialog'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/ConfirmDiscardDialog.tsx b/ts/components/ConfirmDiscardDialog.tsx index a17e16e92..8f0210f68 100644 --- a/ts/components/ConfirmDiscardDialog.tsx +++ b/ts/components/ConfirmDiscardDialog.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { ConfirmationDialog } from './ConfirmationDialog'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/ConfirmationDialog.tsx b/ts/components/ConfirmationDialog.tsx index a598cd93f..2f63e4cd6 100644 --- a/ts/components/ConfirmationDialog.tsx +++ b/ts/components/ConfirmationDialog.tsx @@ -1,13 +1,14 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { MouseEvent, useCallback } from 'react'; +import type { MouseEvent } from 'react'; +import React, { useCallback } from 'react'; import { animated } from '@react-spring/web'; import { Button, ButtonVariant } from './Button'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { ModalHost } from './ModalHost'; import { Modal, ModalWindow } from './Modal'; -import { Theme } from '../util/theme'; +import type { Theme } from '../util/theme'; import { useAnimated } from '../hooks/useAnimated'; export type ActionSpec = { diff --git a/ts/components/ContactListItem.tsx b/ts/components/ContactListItem.tsx index 932544eb2..dcdd22d16 100644 --- a/ts/components/ContactListItem.tsx +++ b/ts/components/ContactListItem.tsx @@ -9,8 +9,8 @@ import { Avatar } from './Avatar'; import { Emojify } from './conversation/Emojify'; import { InContactsIcon } from './InContactsIcon'; -import { LocalizerType } from '../types/Util'; -import { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; import { isInSystemContacts } from '../util/isInSystemContacts'; type Props = { diff --git a/ts/components/ContactPill.tsx b/ts/components/ContactPill.tsx index 8cb47fa72..4f6f9b6f2 100644 --- a/ts/components/ContactPill.tsx +++ b/ts/components/ContactPill.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; -import { ConversationType } from '../state/ducks/conversations'; -import { LocalizerType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; import { ContactName } from './conversation/ContactName'; import { Avatar, AvatarSize } from './Avatar'; diff --git a/ts/components/ContactPills.stories.tsx b/ts/components/ContactPills.stories.tsx index eb3c0904e..d2052d7c4 100644 --- a/ts/components/ContactPills.stories.tsx +++ b/ts/components/ContactPills.stories.tsx @@ -10,7 +10,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; import { ContactPills } from './ContactPills'; -import { ContactPill, PropsType as ContactPillPropsType } from './ContactPill'; +import type { PropsType as ContactPillPropsType } from './ContactPill'; +import { ContactPill } from './ContactPill'; import { gifUrl } from '../storybook/Fixtures'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/ContactPills.tsx b/ts/components/ContactPills.tsx index 6050d3b36..4305d7a39 100644 --- a/ts/components/ContactPills.tsx +++ b/ts/components/ContactPills.tsx @@ -1,13 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - useRef, - useEffect, - Children, - FunctionComponent, - ReactNode, -} from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React, { useRef, useEffect, Children } from 'react'; import { usePrevious } from '../hooks/usePrevious'; import { scrollToBottom } from '../util/scrollToBottom'; diff --git a/ts/components/ConversationList.stories.tsx b/ts/components/ConversationList.stories.tsx index fc64b1dd8..6519acb7e 100644 --- a/ts/components/ConversationList.stories.tsx +++ b/ts/components/ConversationList.stories.tsx @@ -8,12 +8,11 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { boolean, date, select, text } from '@storybook/addon-knobs'; -import { ConversationList, PropsType, RowType, Row } from './ConversationList'; +import type { PropsType, Row } from './ConversationList'; +import { ConversationList, RowType } from './ConversationList'; import { MessageSearchResult } from './conversationList/MessageSearchResult'; -import { - PropsData as ConversationListItemPropsType, - MessageStatuses, -} from './conversationList/ConversationListItem'; +import type { PropsData as ConversationListItemPropsType } from './conversationList/ConversationListItem'; +import { MessageStatuses } from './conversationList/ConversationListItem'; import { ContactCheckboxDisabledReason } from './conversationList/ContactCheckbox'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { setupI18n } from '../util/setupI18n'; diff --git a/ts/components/ConversationList.tsx b/ts/components/ConversationList.tsx index c735dfd11..e8cceaa6c 100644 --- a/ts/components/ConversationList.tsx +++ b/ts/components/ConversationList.tsx @@ -1,28 +1,25 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useRef, useEffect, useCallback, ReactNode } from 'react'; -import { List, ListRowRenderer } from 'react-virtualized'; +import type { ReactNode } from 'react'; +import React, { useRef, useEffect, useCallback } from 'react'; +import type { ListRowRenderer } from 'react-virtualized'; +import { List } from 'react-virtualized'; import classNames from 'classnames'; import { get, pick } from 'lodash'; import { missingCaseError } from '../util/missingCaseError'; import { assert } from '../util/assert'; -import { LocalizerType, ScrollBehavior } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; +import { ScrollBehavior } from '../types/Util'; import { getConversationListWidthBreakpoint } from './_util'; -import { - ConversationListItem, - PropsData as ConversationListItemPropsType, -} from './conversationList/ConversationListItem'; -import { - ContactListItem, - PropsDataType as ContactListItemPropsType, -} from './conversationList/ContactListItem'; -import { - ContactCheckbox as ContactCheckboxComponent, - ContactCheckboxDisabledReason, -} from './conversationList/ContactCheckbox'; +import type { PropsData as ConversationListItemPropsType } from './conversationList/ConversationListItem'; +import { ConversationListItem } from './conversationList/ConversationListItem'; +import type { PropsDataType as ContactListItemPropsType } from './conversationList/ContactListItem'; +import { ContactListItem } from './conversationList/ContactListItem'; +import type { ContactCheckboxDisabledReason } from './conversationList/ContactCheckbox'; +import { ContactCheckbox as ContactCheckboxComponent } from './conversationList/ContactCheckbox'; import { CreateNewGroupButton } from './conversationList/CreateNewGroupButton'; import { StartNewConversation as StartNewConversationComponent } from './conversationList/StartNewConversation'; import { SearchResultsLoadingFakeHeader as SearchResultsLoadingFakeHeaderComponent } from './conversationList/SearchResultsLoadingFakeHeader'; diff --git a/ts/components/Countdown.stories.tsx b/ts/components/Countdown.stories.tsx index 56529b3a5..12f801fe5 100644 --- a/ts/components/Countdown.stories.tsx +++ b/ts/components/Countdown.stories.tsx @@ -7,7 +7,8 @@ import { action } from '@storybook/addon-actions'; import { date, number } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { Countdown, Props } from './Countdown'; +import type { Props } from './Countdown'; +import { Countdown } from './Countdown'; const defaultDuration = 10 * 1000; const createProps = (overrideProps: Partial = {}): Props => ({ diff --git a/ts/components/CustomColorEditor.stories.tsx b/ts/components/CustomColorEditor.stories.tsx index 040be88cd..8b9614477 100644 --- a/ts/components/CustomColorEditor.stories.tsx +++ b/ts/components/CustomColorEditor.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import enMessages from '../../_locales/en/messages.json'; -import { CustomColorEditor, PropsType } from './CustomColorEditor'; +import type { PropsType } from './CustomColorEditor'; +import { CustomColorEditor } from './CustomColorEditor'; import { setupI18n } from '../util/setupI18n'; const story = storiesOf('Components/CustomColorEditor', module); diff --git a/ts/components/CustomColorEditor.tsx b/ts/components/CustomColorEditor.tsx index 8083dfbaf..f50d10054 100644 --- a/ts/components/CustomColorEditor.tsx +++ b/ts/components/CustomColorEditor.tsx @@ -7,8 +7,8 @@ import { GradientDial, KnobType } from './GradientDial'; import { SampleMessageBubbles } from './SampleMessageBubbles'; import { Slider } from './Slider'; import { Tabs } from './Tabs'; -import { CustomColorType } from '../types/Colors'; -import { LocalizerType } from '../types/Util'; +import type { CustomColorType } from '../types/Colors'; +import type { LocalizerType } from '../types/Util'; import { getHSL } from '../util/getHSL'; import { getCustomColorStyle } from '../util/getCustomColorStyle'; diff --git a/ts/components/CustomizingPreferredReactionsModal.stories.tsx b/ts/components/CustomizingPreferredReactionsModal.stories.tsx index 92709864a..d9922c072 100644 --- a/ts/components/CustomizingPreferredReactionsModal.stories.tsx +++ b/ts/components/CustomizingPreferredReactionsModal.stories.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ComponentProps } from 'react'; +import type { ComponentProps } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; diff --git a/ts/components/DebugLogWindow.stories.tsx b/ts/components/DebugLogWindow.stories.tsx index f3751ed25..aa5ee4852 100644 --- a/ts/components/DebugLogWindow.stories.tsx +++ b/ts/components/DebugLogWindow.stories.tsx @@ -6,7 +6,8 @@ import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; import enMessages from '../../_locales/en/messages.json'; -import { DebugLogWindow, PropsType } from './DebugLogWindow'; +import type { PropsType } from './DebugLogWindow'; +import { DebugLogWindow } from './DebugLogWindow'; import { setupI18n } from '../util/setupI18n'; import { sleep } from '../util/sleep'; diff --git a/ts/components/DebugLogWindow.tsx b/ts/components/DebugLogWindow.tsx index 61f119d15..db382b1a9 100644 --- a/ts/components/DebugLogWindow.tsx +++ b/ts/components/DebugLogWindow.tsx @@ -1,11 +1,12 @@ // Copyright 2015-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { MouseEvent, useEffect, useState } from 'react'; +import type { MouseEvent } from 'react'; +import React, { useEffect, useState } from 'react'; import copyText from 'copy-text-to-clipboard'; import * as log from '../logging/log'; import { Button, ButtonVariant } from './Button'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Spinner } from './Spinner'; import { ToastDebugLogError } from './ToastDebugLogError'; import { ToastLinkCopied } from './ToastLinkCopied'; diff --git a/ts/components/DialogExpiredBuild.tsx b/ts/components/DialogExpiredBuild.tsx index 452ce48d1..0ab680ee6 100644 --- a/ts/components/DialogExpiredBuild.tsx +++ b/ts/components/DialogExpiredBuild.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import type { WidthBreakpoint } from './_util'; import { LeftPaneDialog } from './LeftPaneDialog'; diff --git a/ts/components/DialogNetworkStatus.tsx b/ts/components/DialogNetworkStatus.tsx index 854c56d6e..6de3e0dba 100644 --- a/ts/components/DialogNetworkStatus.tsx +++ b/ts/components/DialogNetworkStatus.tsx @@ -5,9 +5,9 @@ import React, { useEffect } from 'react'; import { LeftPaneDialog } from './LeftPaneDialog'; import { Spinner } from './Spinner'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { SocketStatus } from '../types/SocketStatus'; -import { NetworkStateType } from '../state/ducks/network'; +import type { NetworkStateType } from '../state/ducks/network'; import type { WidthBreakpoint } from './_util'; const FIVE_SECONDS = 5 * 1000; diff --git a/ts/components/DialogRelink.tsx b/ts/components/DialogRelink.tsx index 3b8d5543d..dd3202c98 100644 --- a/ts/components/DialogRelink.tsx +++ b/ts/components/DialogRelink.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import type { WidthBreakpoint } from './_util'; import { LeftPaneDialog } from './LeftPaneDialog'; diff --git a/ts/components/DialogUpdate.tsx b/ts/components/DialogUpdate.tsx index 261b60e97..201dd1138 100644 --- a/ts/components/DialogUpdate.tsx +++ b/ts/components/DialogUpdate.tsx @@ -5,7 +5,7 @@ import React from 'react'; import formatFileSize from 'filesize'; import { DialogType } from '../types/Dialogs'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Intl } from './Intl'; import { LeftPaneDialog } from './LeftPaneDialog'; import type { WidthBreakpoint } from './_util'; diff --git a/ts/components/DirectCallRemoteParticipant.tsx b/ts/components/DirectCallRemoteParticipant.tsx index 952bca12a..648f53767 100644 --- a/ts/components/DirectCallRemoteParticipant.tsx +++ b/ts/components/DirectCallRemoteParticipant.tsx @@ -2,9 +2,9 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useRef, useEffect } from 'react'; -import { SetRendererCanvasType } from '../state/ducks/calling'; -import { ConversationType } from '../state/ducks/conversations'; -import { LocalizerType } from '../types/Util'; +import type { SetRendererCanvasType } from '../state/ducks/calling'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; import { AvatarColors } from '../types/Colors'; import { Avatar } from './Avatar'; diff --git a/ts/components/DisappearingTimeDialog.tsx b/ts/components/DisappearingTimeDialog.tsx index 7c3228bdd..393104b69 100644 --- a/ts/components/DisappearingTimeDialog.tsx +++ b/ts/components/DisappearingTimeDialog.tsx @@ -5,8 +5,8 @@ import React, { useState } from 'react'; import { ConfirmationDialog } from './ConfirmationDialog'; import { Select } from './Select'; -import { LocalizerType } from '../types/Util'; -import { Theme } from '../util/theme'; +import type { LocalizerType } from '../types/Util'; +import type { Theme } from '../util/theme'; const CSS_MODULE = 'module-disappearing-time-dialog'; diff --git a/ts/components/DisappearingTimerSelect.tsx b/ts/components/DisappearingTimerSelect.tsx index a4d4cba7b..13f096190 100644 --- a/ts/components/DisappearingTimerSelect.tsx +++ b/ts/components/DisappearingTimerSelect.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useState, ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React, { useState } from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import * as expirationTimer from '../util/expirationTimer'; import { DisappearingTimeDialog } from './DisappearingTimeDialog'; diff --git a/ts/components/ErrorModal.stories.tsx b/ts/components/ErrorModal.stories.tsx index 8ca687012..63aaf943b 100644 --- a/ts/components/ErrorModal.stories.tsx +++ b/ts/components/ErrorModal.stories.tsx @@ -6,7 +6,8 @@ import { storiesOf } from '@storybook/react'; import { text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { PropsType, ErrorModal } from './ErrorModal'; +import type { PropsType } from './ErrorModal'; +import { ErrorModal } from './ErrorModal'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/ErrorModal.tsx b/ts/components/ErrorModal.tsx index edfc214d4..485ac0342 100644 --- a/ts/components/ErrorModal.tsx +++ b/ts/components/ErrorModal.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Modal } from './Modal'; import { Button, ButtonVariant } from './Button'; diff --git a/ts/components/ForwardMessageModal.stories.tsx b/ts/components/ForwardMessageModal.stories.tsx index 744be13a1..8c2250aaa 100644 --- a/ts/components/ForwardMessageModal.stories.tsx +++ b/ts/components/ForwardMessageModal.stories.tsx @@ -8,8 +8,9 @@ import { action } from '@storybook/addon-actions'; import { text } from '@storybook/addon-knobs'; import enMessages from '../../_locales/en/messages.json'; -import { AttachmentType } from '../types/Attachment'; -import { ForwardMessageModal, PropsType } from './ForwardMessageModal'; +import type { AttachmentType } from '../types/Attachment'; +import type { PropsType } from './ForwardMessageModal'; +import { ForwardMessageModal } from './ForwardMessageModal'; import { IMAGE_JPEG, VIDEO_MP4, stringToMIMEType } from '../types/MIME'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { setupI18n } from '../util/setupI18n'; diff --git a/ts/components/ForwardMessageModal.tsx b/ts/components/ForwardMessageModal.tsx index 4bbedd1c2..9ddc957e2 100644 --- a/ts/components/ForwardMessageModal.tsx +++ b/ts/components/ForwardMessageModal.tsx @@ -1,31 +1,35 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { FunctionComponent } from 'react'; import React, { - FunctionComponent, useCallback, useEffect, useMemo, useRef, useState, } from 'react'; -import Measure, { MeasuredComponentProps } from 'react-measure'; +import type { MeasuredComponentProps } from 'react-measure'; +import Measure from 'react-measure'; import { noop } from 'lodash'; import { animated } from '@react-spring/web'; import classNames from 'classnames'; import { AttachmentList } from './conversation/AttachmentList'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; import { Button } from './Button'; -import { CompositionInput, InputApi } from './CompositionInput'; +import type { InputApi } from './CompositionInput'; +import { CompositionInput } from './CompositionInput'; import { ConfirmationDialog } from './ConfirmationDialog'; import { ContactCheckboxDisabledReason } from './conversationList/ContactCheckbox'; -import { ConversationList, Row, RowType } from './ConversationList'; -import { ConversationType } from '../state/ducks/conversations'; -import { EmojiButton, Props as EmojiButtonProps } from './emoji/EmojiButton'; -import { EmojiPickDataType } from './emoji/EmojiPicker'; -import { LinkPreviewType } from '../types/message/LinkPreviews'; -import { BodyRangeType, LocalizerType } from '../types/Util'; +import type { Row } from './ConversationList'; +import { ConversationList, RowType } from './ConversationList'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { Props as EmojiButtonProps } from './emoji/EmojiButton'; +import { EmojiButton } from './emoji/EmojiButton'; +import type { EmojiPickDataType } from './emoji/EmojiPicker'; +import type { LinkPreviewType } from '../types/message/LinkPreviews'; +import type { BodyRangeType, LocalizerType } from '../types/Util'; import { ModalHost } from './ModalHost'; import { SearchInput } from './SearchInput'; import { StagedLinkPreview } from './conversation/StagedLinkPreview'; diff --git a/ts/components/GlobalAudioContext.tsx b/ts/components/GlobalAudioContext.tsx index c694f470a..9453dd617 100644 --- a/ts/components/GlobalAudioContext.tsx +++ b/ts/components/GlobalAudioContext.tsx @@ -5,7 +5,7 @@ import * as React from 'react'; import PQueue from 'p-queue'; import LRU from 'lru-cache'; -import { WaveformCache } from '../types/Audio'; +import type { WaveformCache } from '../types/Audio'; import * as log from '../logging/log'; const MAX_WAVEFORM_COUNT = 1000; diff --git a/ts/components/GlobalModalContainer.tsx b/ts/components/GlobalModalContainer.tsx index d35cb8042..006a265d2 100644 --- a/ts/components/GlobalModalContainer.tsx +++ b/ts/components/GlobalModalContainer.tsx @@ -2,8 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { ContactModalStateType } from '../state/ducks/globalModals'; -import { LocalizerType } from '../types/Util'; +import type { ContactModalStateType } from '../state/ducks/globalModals'; +import type { LocalizerType } from '../types/Util'; import { WhatsNewModal } from './WhatsNewModal'; diff --git a/ts/components/GradientDial.tsx b/ts/components/GradientDial.tsx index f3bcf4413..0e7c74369 100644 --- a/ts/components/GradientDial.tsx +++ b/ts/components/GradientDial.tsx @@ -1,13 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - CSSProperties, - KeyboardEvent, - useEffect, - useRef, - useState, -} from 'react'; +import type { CSSProperties, KeyboardEvent } from 'react'; +import React, { useEffect, useRef, useState } from 'react'; import classNames from 'classnames'; export enum KnobType { diff --git a/ts/components/GroupCallOverflowArea.stories.tsx b/ts/components/GroupCallOverflowArea.stories.tsx index cd83e275c..a37ba5a53 100644 --- a/ts/components/GroupCallOverflowArea.stories.tsx +++ b/ts/components/GroupCallOverflowArea.stories.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FC } from 'react'; +import type { FC } from 'react'; +import React from 'react'; import { memoize, times } from 'lodash'; import { v4 as generateUuid } from 'uuid'; import { storiesOf } from '@storybook/react'; diff --git a/ts/components/GroupCallOverflowArea.tsx b/ts/components/GroupCallOverflowArea.tsx index a11cb5243..0042682a7 100644 --- a/ts/components/GroupCallOverflowArea.tsx +++ b/ts/components/GroupCallOverflowArea.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useRef, useState, useEffect, FC, ReactElement } from 'react'; +import type { FC, ReactElement } from 'react'; +import React, { useRef, useState, useEffect } from 'react'; import classNames from 'classnames'; import type { VideoFrameSource } from 'ringrtc'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import type { GroupCallRemoteParticipantType } from '../types/Calling'; import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant'; diff --git a/ts/components/GroupCallRemoteParticipant.stories.tsx b/ts/components/GroupCallRemoteParticipant.stories.tsx index f03490318..0a2fccdbd 100644 --- a/ts/components/GroupCallRemoteParticipant.stories.tsx +++ b/ts/components/GroupCallRemoteParticipant.stories.tsx @@ -5,10 +5,8 @@ import * as React from 'react'; import { memoize, noop } from 'lodash'; import { storiesOf } from '@storybook/react'; -import { - GroupCallRemoteParticipant, - PropsType, -} from './GroupCallRemoteParticipant'; +import type { PropsType } from './GroupCallRemoteParticipant'; +import { GroupCallRemoteParticipant } from './GroupCallRemoteParticipant'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; import { FRAME_BUFFER_SIZE } from '../calling/constants'; import { setupI18n } from '../util/setupI18n'; diff --git a/ts/components/GroupCallRemoteParticipant.tsx b/ts/components/GroupCallRemoteParticipant.tsx index 7eaec314d..605c04434 100644 --- a/ts/components/GroupCallRemoteParticipant.tsx +++ b/ts/components/GroupCallRemoteParticipant.tsx @@ -1,19 +1,19 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { CSSProperties } from 'react'; import React, { useState, useRef, useMemo, useCallback, useEffect, - CSSProperties, } from 'react'; import classNames from 'classnames'; import { noop } from 'lodash'; import type { VideoFrameSource } from 'ringrtc'; import type { GroupCallRemoteParticipantType } from '../types/Calling'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { AvatarColors } from '../types/Colors'; import { CallBackgroundBlur } from './CallBackgroundBlur'; import { Avatar, AvatarSize } from './Avatar'; diff --git a/ts/components/GroupCallRemoteParticipants.tsx b/ts/components/GroupCallRemoteParticipants.tsx index 8a90f1086..f700fdacf 100644 --- a/ts/components/GroupCallRemoteParticipants.tsx +++ b/ts/components/GroupCallRemoteParticipants.tsx @@ -10,12 +10,12 @@ import { GroupCallOverflowArea, OVERFLOW_PARTICIPANT_WIDTH, } from './GroupCallOverflowArea'; -import { +import type { GroupCallRemoteParticipantType, GroupCallVideoRequest, } from '../types/Calling'; import { useGetCallingFrameBuffer } from '../calling/useGetCallingFrameBuffer'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { usePageVisibility } from '../hooks/usePageVisibility'; import { nonRenderedRemoteParticipant } from '../util/ringrtc/nonRenderedRemoteParticipant'; import * as log from '../logging/log'; diff --git a/ts/components/GroupDescriptionInput.tsx b/ts/components/GroupDescriptionInput.tsx index bd3ea60ef..4092a9566 100644 --- a/ts/components/GroupDescriptionInput.tsx +++ b/ts/components/GroupDescriptionInput.tsx @@ -4,7 +4,7 @@ import React, { forwardRef } from 'react'; import { Input } from './Input'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; type PropsType = { disabled?: boolean; diff --git a/ts/components/GroupDescriptionText.tsx b/ts/components/GroupDescriptionText.tsx index b1eff4a94..c9b61310f 100644 --- a/ts/components/GroupDescriptionText.tsx +++ b/ts/components/GroupDescriptionText.tsx @@ -1,8 +1,9 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; -import { RenderTextCallbackType } from '../types/Util'; +import type { FunctionComponent } from 'react'; +import React from 'react'; +import type { RenderTextCallbackType } from '../types/Util'; import { AddNewLines } from './conversation/AddNewLines'; import { Emojify } from './conversation/Emojify'; import { Linkify } from './conversation/Linkify'; diff --git a/ts/components/GroupDialog.tsx b/ts/components/GroupDialog.tsx index 88f91a026..6c04eb821 100644 --- a/ts/components/GroupDialog.tsx +++ b/ts/components/GroupDialog.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild, ReactNode } from 'react'; +import type { ReactChild, ReactNode } from 'react'; +import React from 'react'; -import { LocalizerType } from '../types/Util'; -import { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; import { ModalHost } from './ModalHost'; import { Button, ButtonVariant } from './Button'; import { Avatar, AvatarSize } from './Avatar'; diff --git a/ts/components/GroupTitleInput.tsx b/ts/components/GroupTitleInput.tsx index 0043066f9..f200c1394 100644 --- a/ts/components/GroupTitleInput.tsx +++ b/ts/components/GroupTitleInput.tsx @@ -4,7 +4,7 @@ import React, { forwardRef } from 'react'; import { Input } from './Input'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; type PropsType = { disabled?: boolean; diff --git a/ts/components/GroupV1MigrationDialog.stories.tsx b/ts/components/GroupV1MigrationDialog.stories.tsx index 4c5207ee8..c657438d1 100644 --- a/ts/components/GroupV1MigrationDialog.stories.tsx +++ b/ts/components/GroupV1MigrationDialog.stories.tsx @@ -7,8 +7,9 @@ import { isBoolean } from 'lodash'; import { boolean } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { GroupV1MigrationDialog, PropsType } from './GroupV1MigrationDialog'; -import { ConversationType } from '../state/ducks/conversations'; +import type { PropsType } from './GroupV1MigrationDialog'; +import { GroupV1MigrationDialog } from './GroupV1MigrationDialog'; +import type { ConversationType } from '../state/ducks/conversations'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/GroupV1MigrationDialog.tsx b/ts/components/GroupV1MigrationDialog.tsx index 68f43336f..46fd800e1 100644 --- a/ts/components/GroupV1MigrationDialog.tsx +++ b/ts/components/GroupV1MigrationDialog.tsx @@ -2,8 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { LocalizerType } from '../types/Util'; -import { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; import { GroupDialog } from './GroupDialog'; import { sortByTitle } from '../util/sortByTitle'; diff --git a/ts/components/GroupV2JoinDialog.stories.tsx b/ts/components/GroupV2JoinDialog.stories.tsx index 71b72144e..97c6ab319 100644 --- a/ts/components/GroupV2JoinDialog.stories.tsx +++ b/ts/components/GroupV2JoinDialog.stories.tsx @@ -6,7 +6,8 @@ import { storiesOf } from '@storybook/react'; import { boolean, number, text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { GroupV2JoinDialog, PropsType } from './GroupV2JoinDialog'; +import type { PropsType } from './GroupV2JoinDialog'; +import { GroupV2JoinDialog } from './GroupV2JoinDialog'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/GroupV2JoinDialog.tsx b/ts/components/GroupV2JoinDialog.tsx index 7bdec6bc7..e5a2134df 100644 --- a/ts/components/GroupV2JoinDialog.tsx +++ b/ts/components/GroupV2JoinDialog.tsx @@ -3,13 +3,13 @@ import * as React from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Avatar, AvatarBlur } from './Avatar'; import { Spinner } from './Spinner'; import { Button, ButtonVariant } from './Button'; import { GroupDescription } from './conversation/GroupDescription'; -import { PreJoinConversationType } from '../state/ducks/conversations'; +import type { PreJoinConversationType } from '../state/ducks/conversations'; type CallbackType = () => unknown; diff --git a/ts/components/InContactsIcon.tsx b/ts/components/InContactsIcon.tsx index 7d6f174f1..42e9b3e2b 100644 --- a/ts/components/InContactsIcon.tsx +++ b/ts/components/InContactsIcon.tsx @@ -5,7 +5,7 @@ import React from 'react'; import classNames from 'classnames'; import { Tooltip } from './Tooltip'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; type PropsType = { className?: string; diff --git a/ts/components/Inbox.tsx b/ts/components/Inbox.tsx index 734d333a7..954d973ef 100644 --- a/ts/components/Inbox.tsx +++ b/ts/components/Inbox.tsx @@ -1,12 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode, useEffect, useRef } from 'react'; -import * as Backbone from 'backbone'; -import { - SafetyNumberChangeDialog, - SafetyNumberProps, -} from './SafetyNumberChangeDialog'; +import type { ReactNode } from 'react'; +import React, { useEffect, useRef } from 'react'; +import type * as Backbone from 'backbone'; +import type { SafetyNumberProps } from './SafetyNumberChangeDialog'; +import { SafetyNumberChangeDialog } from './SafetyNumberChangeDialog'; import type { ConversationType } from '../state/ducks/conversations'; import type { LocalizerType } from '../types/Util'; diff --git a/ts/components/IncomingCallBar.tsx b/ts/components/IncomingCallBar.tsx index aa777ae4e..b61a19bf3 100644 --- a/ts/components/IncomingCallBar.tsx +++ b/ts/components/IncomingCallBar.tsx @@ -1,7 +1,8 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useEffect, useRef, ReactChild } from 'react'; +import type { ReactChild } from 'react'; +import React, { useEffect, useRef } from 'react'; import { Avatar } from './Avatar'; import { Tooltip } from './Tooltip'; import { Intl } from './Intl'; @@ -9,11 +10,11 @@ import { Theme } from '../util/theme'; import { getParticipantName } from '../util/callingGetParticipantName'; import { ContactName } from './conversation/ContactName'; import { Emojify } from './conversation/Emojify'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { AvatarColors } from '../types/Colors'; import { CallMode } from '../types/Calling'; -import { ConversationType } from '../state/ducks/conversations'; -import { AcceptCallType, DeclineCallType } from '../state/ducks/calling'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { AcceptCallType, DeclineCallType } from '../state/ducks/calling'; import { missingCaseError } from '../util/missingCaseError'; export type PropsType = { diff --git a/ts/components/Input.stories.tsx b/ts/components/Input.stories.tsx index 9f04f5896..8fe19a1d9 100644 --- a/ts/components/Input.stories.tsx +++ b/ts/components/Input.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { Input, PropsType } from './Input'; +import type { PropsType } from './Input'; +import { Input } from './Input'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/Input.tsx b/ts/components/Input.tsx index 462fed8ed..562aad445 100644 --- a/ts/components/Input.tsx +++ b/ts/components/Input.tsx @@ -1,9 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { ClipboardEvent, ReactNode } from 'react'; import React, { - ClipboardEvent, - ReactNode, forwardRef, useCallback, useEffect, @@ -13,7 +12,7 @@ import React, { import classNames from 'classnames'; import * as grapheme from '../util/grapheme'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { getClassNamesFor } from '../util/getClassNamesFor'; import { refMerger } from '../util/refMerger'; import { byteLength } from '../Bytes'; diff --git a/ts/components/Intl.stories.tsx b/ts/components/Intl.stories.tsx index af60254ba..b6fd43fb7 100644 --- a/ts/components/Intl.stories.tsx +++ b/ts/components/Intl.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { Intl, Props } from './Intl'; +import type { Props } from './Intl'; +import { Intl } from './Intl'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/Intl.tsx b/ts/components/Intl.tsx index bd8b03a2a..5100da004 100644 --- a/ts/components/Intl.tsx +++ b/ts/components/Intl.tsx @@ -3,8 +3,8 @@ import React from 'react'; -import { LocalizerType, RenderTextCallbackType } from '../types/Util'; -import { ReplacementValuesType } from '../types/I18N'; +import type { LocalizerType, RenderTextCallbackType } from '../types/Util'; +import type { ReplacementValuesType } from '../types/I18N'; import * as log from '../logging/log'; export type FullJSXType = Array | JSX.Element | string; diff --git a/ts/components/LeftPane.stories.tsx b/ts/components/LeftPane.stories.tsx index 5e9632e3d..400be6aca 100644 --- a/ts/components/LeftPane.stories.tsx +++ b/ts/components/LeftPane.stories.tsx @@ -7,9 +7,10 @@ import { action } from '@storybook/addon-actions'; import { select } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { LeftPane, LeftPaneMode, PropsType } from './LeftPane'; +import type { PropsType } from './LeftPane'; +import { LeftPane, LeftPaneMode } from './LeftPane'; import { CaptchaDialog } from './CaptchaDialog'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { MessageSearchResult } from './conversationList/MessageSearchResult'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/LeftPane.tsx b/ts/components/LeftPane.tsx index 0db539685..ab0e216de 100644 --- a/ts/components/LeftPane.tsx +++ b/ts/components/LeftPane.tsx @@ -2,52 +2,40 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useEffect, useCallback, useMemo, useState } from 'react'; -import Measure, { MeasuredComponentProps } from 'react-measure'; +import type { MeasuredComponentProps } from 'react-measure'; +import Measure from 'react-measure'; import classNames from 'classnames'; import { clamp, isNumber, noop } from 'lodash'; -import { - LeftPaneHelper, - FindDirection, - ToFindType, -} from './leftPane/LeftPaneHelper'; -import { - LeftPaneInboxHelper, - LeftPaneInboxPropsType, -} from './leftPane/LeftPaneInboxHelper'; -import { - LeftPaneSearchHelper, - LeftPaneSearchPropsType, -} from './leftPane/LeftPaneSearchHelper'; -import { - LeftPaneArchiveHelper, - LeftPaneArchivePropsType, -} from './leftPane/LeftPaneArchiveHelper'; -import { - LeftPaneComposeHelper, - LeftPaneComposePropsType, -} from './leftPane/LeftPaneComposeHelper'; -import { - LeftPaneChooseGroupMembersHelper, - LeftPaneChooseGroupMembersPropsType, -} from './leftPane/LeftPaneChooseGroupMembersHelper'; -import { - LeftPaneSetGroupMetadataHelper, - LeftPaneSetGroupMetadataPropsType, -} from './leftPane/LeftPaneSetGroupMetadataHelper'; +import type { LeftPaneHelper, ToFindType } from './leftPane/LeftPaneHelper'; +import { FindDirection } from './leftPane/LeftPaneHelper'; +import type { LeftPaneInboxPropsType } from './leftPane/LeftPaneInboxHelper'; +import { LeftPaneInboxHelper } from './leftPane/LeftPaneInboxHelper'; +import type { LeftPaneSearchPropsType } from './leftPane/LeftPaneSearchHelper'; +import { LeftPaneSearchHelper } from './leftPane/LeftPaneSearchHelper'; +import type { LeftPaneArchivePropsType } from './leftPane/LeftPaneArchiveHelper'; +import { LeftPaneArchiveHelper } from './leftPane/LeftPaneArchiveHelper'; +import type { LeftPaneComposePropsType } from './leftPane/LeftPaneComposeHelper'; +import { LeftPaneComposeHelper } from './leftPane/LeftPaneComposeHelper'; +import type { LeftPaneChooseGroupMembersPropsType } from './leftPane/LeftPaneChooseGroupMembersHelper'; +import { LeftPaneChooseGroupMembersHelper } from './leftPane/LeftPaneChooseGroupMembersHelper'; +import type { LeftPaneSetGroupMetadataPropsType } from './leftPane/LeftPaneSetGroupMetadataHelper'; +import { LeftPaneSetGroupMetadataHelper } from './leftPane/LeftPaneSetGroupMetadataHelper'; import * as OS from '../OS'; -import { LocalizerType, ScrollBehavior } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; +import { ScrollBehavior } from '../types/Util'; import { usePrevious } from '../hooks/usePrevious'; import { missingCaseError } from '../util/missingCaseError'; import { strictAssert } from '../util/assert'; import { isSorted } from '../util/isSorted'; -import { getConversationListWidthBreakpoint, WidthBreakpoint } from './_util'; +import type { WidthBreakpoint } from './_util'; +import { getConversationListWidthBreakpoint } from './_util'; import { ConversationList } from './ConversationList'; import { ContactCheckboxDisabledReason } from './conversationList/ContactCheckbox'; -import { +import type { DeleteAvatarFromDiskActionType, ReplaceAvatarActionType, SaveAvatarToDiskActionType, diff --git a/ts/components/LeftPaneDialog.tsx b/ts/components/LeftPaneDialog.tsx index c6aec1f7e..628176f65 100644 --- a/ts/components/LeftPaneDialog.tsx +++ b/ts/components/LeftPaneDialog.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild, ReactNode } from 'react'; +import type { ReactChild, ReactNode } from 'react'; +import React from 'react'; import classNames from 'classnames'; import { Tooltip, TooltipPlacement } from './Tooltip'; import { WidthBreakpoint } from './_util'; diff --git a/ts/components/Lightbox.stories.tsx b/ts/components/Lightbox.stories.tsx index 714a86c96..0806c5136 100644 --- a/ts/components/Lightbox.stories.tsx +++ b/ts/components/Lightbox.stories.tsx @@ -8,8 +8,9 @@ import { action } from '@storybook/addon-actions'; import { number } from '@storybook/addon-knobs'; import enMessages from '../../_locales/en/messages.json'; -import { Lightbox, PropsType } from './Lightbox'; -import { MediaItemType } from '../types/MediaItem'; +import type { PropsType } from './Lightbox'; +import { Lightbox } from './Lightbox'; +import type { MediaItemType } from '../types/MediaItem'; import { setupI18n } from '../util/setupI18n'; import { AUDIO_MP3, diff --git a/ts/components/Lightbox.tsx b/ts/components/Lightbox.tsx index 1ff7d6482..32adb84dd 100644 --- a/ts/components/Lightbox.tsx +++ b/ts/components/Lightbox.tsx @@ -1,13 +1,8 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - ReactNode, - useCallback, - useEffect, - useRef, - useState, -} from 'react'; +import type { ReactNode } from 'react'; +import React, { useCallback, useEffect, useRef, useState } from 'react'; import classNames from 'classnames'; import moment from 'moment'; import { createPortal } from 'react-dom'; @@ -15,12 +10,13 @@ import { noop } from 'lodash'; import { useSpring, animated, to } from '@react-spring/web'; import * as GoogleChrome from '../util/GoogleChrome'; -import { AttachmentType, isGIF } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; +import { isGIF } from '../types/Attachment'; import { Avatar, AvatarSize } from './Avatar'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { IMAGE_PNG, isImage, isVideo } from '../types/MIME'; -import { LocalizerType } from '../types/Util'; -import { MediaItemType, MessageAttributesType } from '../types/MediaItem'; +import type { LocalizerType } from '../types/Util'; +import type { MediaItemType, MessageAttributesType } from '../types/MediaItem'; import { formatDuration } from '../util/formatDuration'; import { useRestoreFocus } from '../hooks/useRestoreFocus'; import * as log from '../logging/log'; diff --git a/ts/components/MainHeader.stories.tsx b/ts/components/MainHeader.stories.tsx index c1c27893a..58724071f 100644 --- a/ts/components/MainHeader.stories.tsx +++ b/ts/components/MainHeader.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { MainHeader, PropsType } from './MainHeader'; +import type { PropsType } from './MainHeader'; +import { MainHeader } from './MainHeader'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/MainHeader.tsx b/ts/components/MainHeader.tsx index 3df549e37..f90ba70bb 100644 --- a/ts/components/MainHeader.tsx +++ b/ts/components/MainHeader.tsx @@ -10,9 +10,9 @@ import { createPortal } from 'react-dom'; import { showSettings } from '../shims/Whisper'; import { Avatar } from './Avatar'; import { AvatarPopup } from './AvatarPopup'; -import { LocalizerType } from '../types/Util'; -import { AvatarColorType } from '../types/Colors'; -import { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; +import type { AvatarColorType } from '../types/Colors'; +import type { ConversationType } from '../state/ducks/conversations'; export type PropsType = { searchTerm: string; diff --git a/ts/components/MediaQualitySelector.stories.tsx b/ts/components/MediaQualitySelector.stories.tsx index aa9084d76..66d275e48 100644 --- a/ts/components/MediaQualitySelector.stories.tsx +++ b/ts/components/MediaQualitySelector.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { boolean } from '@storybook/addon-knobs'; import enMessages from '../../_locales/en/messages.json'; -import { MediaQualitySelector, PropsType } from './MediaQualitySelector'; +import type { PropsType } from './MediaQualitySelector'; +import { MediaQualitySelector } from './MediaQualitySelector'; import { setupI18n } from '../util/setupI18n'; const story = storiesOf('Components/MediaQualitySelector', module); diff --git a/ts/components/MediaQualitySelector.tsx b/ts/components/MediaQualitySelector.tsx index 2c9ca37a1..f2c73944d 100644 --- a/ts/components/MediaQualitySelector.tsx +++ b/ts/components/MediaQualitySelector.tsx @@ -1,12 +1,13 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { KeyboardEvent, useCallback, useEffect, useState } from 'react'; +import type { KeyboardEvent } from 'react'; +import React, { useCallback, useEffect, useState } from 'react'; import { noop } from 'lodash'; import { createPortal } from 'react-dom'; import classNames from 'classnames'; import { Manager, Popper, Reference } from 'react-popper'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/Modal.tsx b/ts/components/Modal.tsx index 29a014c40..639c34253 100644 --- a/ts/components/Modal.tsx +++ b/ts/components/Modal.tsx @@ -1,15 +1,17 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactElement, ReactNode, useRef, useState } from 'react'; -import Measure, { ContentRect, MeasuredComponentProps } from 'react-measure'; +import type { ReactElement, ReactNode } from 'react'; +import React, { useRef, useState } from 'react'; +import type { ContentRect, MeasuredComponentProps } from 'react-measure'; +import Measure from 'react-measure'; import classNames from 'classnames'; import { noop } from 'lodash'; import { animated } from '@react-spring/web'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { ModalHost } from './ModalHost'; -import { Theme } from '../util/theme'; +import type { Theme } from '../util/theme'; import { getClassNamesFor } from '../util/getClassNamesFor'; import { useAnimated } from '../hooks/useAnimated'; import { useHasWrapped } from '../hooks/useHasWrapped'; diff --git a/ts/components/ModalHost.tsx b/ts/components/ModalHost.tsx index 966dfffe1..7e5866b36 100644 --- a/ts/components/ModalHost.tsx +++ b/ts/components/ModalHost.tsx @@ -5,10 +5,12 @@ import React, { useEffect } from 'react'; import classNames from 'classnames'; import { createPortal } from 'react-dom'; import FocusTrap from 'focus-trap-react'; -import { SpringValues, animated } from '@react-spring/web'; +import type { SpringValues } from '@react-spring/web'; +import { animated } from '@react-spring/web'; import type { ModalConfigType } from '../hooks/useAnimated'; -import { Theme, themeClassName } from '../util/theme'; +import type { Theme } from '../util/theme'; +import { themeClassName } from '../util/theme'; import { useEscapeHandling } from '../hooks/useEscapeHandling'; export type PropsType = { diff --git a/ts/components/NeedsScreenRecordingPermissionsModal.tsx b/ts/components/NeedsScreenRecordingPermissionsModal.tsx index bcbf0b92b..7aa76d3df 100644 --- a/ts/components/NeedsScreenRecordingPermissionsModal.tsx +++ b/ts/components/NeedsScreenRecordingPermissionsModal.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Theme } from '../util/theme'; import { Modal } from './Modal'; import { Button, ButtonVariant } from './Button'; diff --git a/ts/components/NewlyCreatedGroupInvitedContactsDialog.stories.tsx b/ts/components/NewlyCreatedGroupInvitedContactsDialog.stories.tsx index 0c9143f00..110f44f54 100644 --- a/ts/components/NewlyCreatedGroupInvitedContactsDialog.stories.tsx +++ b/ts/components/NewlyCreatedGroupInvitedContactsDialog.stories.tsx @@ -9,7 +9,7 @@ import { action } from '@storybook/addon-actions'; import { NewlyCreatedGroupInvitedContactsDialog } from './NewlyCreatedGroupInvitedContactsDialog'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/NewlyCreatedGroupInvitedContactsDialog.tsx b/ts/components/NewlyCreatedGroupInvitedContactsDialog.tsx index 97ea93c22..40aee1f28 100644 --- a/ts/components/NewlyCreatedGroupInvitedContactsDialog.tsx +++ b/ts/components/NewlyCreatedGroupInvitedContactsDialog.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React from 'react'; -import { LocalizerType } from '../types/Util'; -import { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; import { Intl } from './Intl'; import { ContactName } from './conversation/ContactName'; import { GroupDialog } from './GroupDialog'; diff --git a/ts/components/PermissionsPopup.tsx b/ts/components/PermissionsPopup.tsx index 293933904..f698ee566 100644 --- a/ts/components/PermissionsPopup.tsx +++ b/ts/components/PermissionsPopup.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { Button, ButtonVariant } from './Button'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { useEscapeHandling } from '../hooks/useEscapeHandling'; export type PropsType = { diff --git a/ts/components/Preferences.stories.tsx b/ts/components/Preferences.stories.tsx index 4a317cfa4..24198b09f 100644 --- a/ts/components/Preferences.stories.tsx +++ b/ts/components/Preferences.stories.tsx @@ -6,7 +6,8 @@ import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; import enMessages from '../../_locales/en/messages.json'; -import { Preferences, PropsType } from './Preferences'; +import type { PropsType } from './Preferences'; +import { Preferences } from './Preferences'; import { setupI18n } from '../util/setupI18n'; import { DEFAULT_CONVERSATION_COLOR } from '../types/Colors'; import { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode'; diff --git a/ts/components/Preferences.tsx b/ts/components/Preferences.tsx index 217093086..08bb39610 100644 --- a/ts/components/Preferences.tsx +++ b/ts/components/Preferences.tsx @@ -1,13 +1,14 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode, useEffect, useState, useCallback } from 'react'; +import type { ReactNode } from 'react'; +import React, { useEffect, useState, useCallback } from 'react'; import { noop } from 'lodash'; import classNames from 'classnames'; import type { AudioDevice } from 'ringrtc'; import type { MediaDeviceSettings } from '../types/Calling'; -import { +import type { ZoomFactorType, ThemeSettingType, NotificationSettingType, @@ -16,14 +17,14 @@ import { Button, ButtonVariant } from './Button'; import { ChatColorPicker } from './ChatColorPicker'; import { Checkbox } from './Checkbox'; import { ConfirmationDialog } from './ConfirmationDialog'; -import { ConversationType } from '../state/ducks/conversations'; -import { +import type { ConversationType } from '../state/ducks/conversations'; +import type { ConversationColorType, CustomColorType, DefaultConversationColorType, } from '../types/Colors'; import { DisappearingTimeDialog } from './DisappearingTimeDialog'; -import { LocalizerType, ThemeType } from '../types/Util'; +import type { LocalizerType, ThemeType } from '../types/Util'; import { PhoneNumberDiscoverability } from '../util/phoneNumberDiscoverability'; import { PhoneNumberSharingMode } from '../util/phoneNumberSharingMode'; import { Select } from './Select'; diff --git a/ts/components/ProfileEditor.stories.tsx b/ts/components/ProfileEditor.stories.tsx index 9d32ef17f..c91334f33 100644 --- a/ts/components/ProfileEditor.stories.tsx +++ b/ts/components/ProfileEditor.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { ProfileEditor, PropsType } from './ProfileEditor'; +import type { PropsType } from './ProfileEditor'; +import { ProfileEditor } from './ProfileEditor'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; import { diff --git a/ts/components/ProfileEditor.tsx b/ts/components/ProfileEditor.tsx index cca98217a..5e3614c05 100644 --- a/ts/components/ProfileEditor.tsx +++ b/ts/components/ProfileEditor.tsx @@ -3,8 +3,9 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; -import { +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; +import type { AvatarDataType, DeleteAvatarFromDiskActionType, ReplaceAvatarActionType, @@ -15,14 +16,15 @@ import { AvatarPreview } from './AvatarPreview'; import { Button, ButtonVariant } from './Button'; import { ConfirmDiscardDialog } from './ConfirmDiscardDialog'; import { Emoji } from './emoji/Emoji'; -import { EmojiButton, Props as EmojiButtonProps } from './emoji/EmojiButton'; -import { EmojiPickDataType } from './emoji/EmojiPicker'; +import type { Props as EmojiButtonProps } from './emoji/EmojiButton'; +import { EmojiButton } from './emoji/EmojiButton'; +import type { EmojiPickDataType } from './emoji/EmojiPicker'; import { Input } from './Input'; import { Intl } from './Intl'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Modal } from './Modal'; import { PanelRow } from './conversation/conversation-details/PanelRow'; -import { ProfileDataType } from '../state/ducks/conversations'; +import type { ProfileDataType } from '../state/ducks/conversations'; import { getEmojiData, unifiedToEmoji } from './emoji/lib'; import { missingCaseError } from '../util/missingCaseError'; diff --git a/ts/components/ProfileEditorModal.tsx b/ts/components/ProfileEditorModal.tsx index 6fd090c32..17d8a689e 100644 --- a/ts/components/ProfileEditorModal.tsx +++ b/ts/components/ProfileEditorModal.tsx @@ -4,12 +4,9 @@ import React, { useState } from 'react'; import { Modal } from './Modal'; import { ConfirmationDialog } from './ConfirmationDialog'; -import { - ProfileEditor, - PropsType as ProfileEditorPropsType, - EditState, -} from './ProfileEditor'; -import { ProfileDataType } from '../state/ducks/conversations'; +import type { PropsType as ProfileEditorPropsType } from './ProfileEditor'; +import { ProfileEditor, EditState } from './ProfileEditor'; +import type { ProfileDataType } from '../state/ducks/conversations'; export type PropsDataType = { hasError: boolean; diff --git a/ts/components/Profiler.tsx b/ts/components/Profiler.tsx index fcc6e49b1..3778c0048 100644 --- a/ts/components/Profiler.tsx +++ b/ts/components/Profiler.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; import * as log from '../logging/log'; type InternalPropsType = Readonly<{ diff --git a/ts/components/ProgressDialog.stories.tsx b/ts/components/ProgressDialog.stories.tsx index e0d0bbc01..8fd887139 100644 --- a/ts/components/ProgressDialog.stories.tsx +++ b/ts/components/ProgressDialog.stories.tsx @@ -4,7 +4,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; -import { ProgressDialog, PropsType } from './ProgressDialog'; +import type { PropsType } from './ProgressDialog'; +import { ProgressDialog } from './ProgressDialog'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; diff --git a/ts/components/ProgressDialog.tsx b/ts/components/ProgressDialog.tsx index 0dc30a24d..c5d9f3496 100644 --- a/ts/components/ProgressDialog.tsx +++ b/ts/components/ProgressDialog.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Spinner } from './Spinner'; export type PropsType = { diff --git a/ts/components/ProgressModal.tsx b/ts/components/ProgressModal.tsx index eff6e1365..ebbb9056f 100644 --- a/ts/components/ProgressModal.tsx +++ b/ts/components/ProgressModal.tsx @@ -4,7 +4,7 @@ import * as React from 'react'; import { createPortal } from 'react-dom'; import { ProgressDialog } from './ProgressDialog'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { readonly i18n: LocalizerType; diff --git a/ts/components/ReactionPickerPicker.tsx b/ts/components/ReactionPickerPicker.tsx index c390fcd87..31f310ca9 100644 --- a/ts/components/ReactionPickerPicker.tsx +++ b/ts/components/ReactionPickerPicker.tsx @@ -1,7 +1,8 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { CSSProperties, ReactNode, forwardRef } from 'react'; +import type { CSSProperties, ReactNode } from 'react'; +import React, { forwardRef } from 'react'; import classNames from 'classnames'; import { Emoji } from './emoji/Emoji'; diff --git a/ts/components/SafetyNumberChangeDialog.tsx b/ts/components/SafetyNumberChangeDialog.tsx index cea73dbb1..b7b9abc6f 100644 --- a/ts/components/SafetyNumberChangeDialog.tsx +++ b/ts/components/SafetyNumberChangeDialog.tsx @@ -9,8 +9,8 @@ import { ConfirmationDialog } from './ConfirmationDialog'; import { InContactsIcon } from './InContactsIcon'; import { Modal } from './Modal'; -import { ConversationType } from '../state/ducks/conversations'; -import { LocalizerType } from '../types/Util'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { LocalizerType } from '../types/Util'; import { isInSystemContacts } from '../util/isInSystemContacts'; export type SafetyNumberProps = { diff --git a/ts/components/SafetyNumberModal.tsx b/ts/components/SafetyNumberModal.tsx index 5810c7cff..7d7e42607 100644 --- a/ts/components/SafetyNumberModal.tsx +++ b/ts/components/SafetyNumberModal.tsx @@ -3,10 +3,8 @@ import React from 'react'; import { Modal } from './Modal'; -import { - SafetyNumberViewer, - PropsType as SafetyNumberViewerPropsType, -} from './SafetyNumberViewer'; +import type { PropsType as SafetyNumberViewerPropsType } from './SafetyNumberViewer'; +import { SafetyNumberViewer } from './SafetyNumberViewer'; type PropsType = { toggleSafetyNumberModal: () => unknown; diff --git a/ts/components/SafetyNumberViewer.stories.tsx b/ts/components/SafetyNumberViewer.stories.tsx index eb6fb0f4d..4c904eb4a 100644 --- a/ts/components/SafetyNumberViewer.stories.tsx +++ b/ts/components/SafetyNumberViewer.stories.tsx @@ -6,7 +6,8 @@ import { action } from '@storybook/addon-actions'; import { boolean, text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { PropsType, SafetyNumberViewer } from './SafetyNumberViewer'; +import type { PropsType } from './SafetyNumberViewer'; +import { SafetyNumberViewer } from './SafetyNumberViewer'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/SafetyNumberViewer.tsx b/ts/components/SafetyNumberViewer.tsx index cea72f70d..1200eca14 100644 --- a/ts/components/SafetyNumberViewer.tsx +++ b/ts/components/SafetyNumberViewer.tsx @@ -3,9 +3,9 @@ import React from 'react'; import { Button, ButtonVariant } from './Button'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { Intl } from './Intl'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { contact?: ConversationType; diff --git a/ts/components/SampleMessageBubbles.tsx b/ts/components/SampleMessageBubbles.tsx index b387ea72f..d6deeb100 100644 --- a/ts/components/SampleMessageBubbles.tsx +++ b/ts/components/SampleMessageBubbles.tsx @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { CSSProperties } from 'react'; -import { ConversationColorType } from '../types/Colors'; -import { LocalizerType } from '../types/Util'; +import type { CSSProperties } from 'react'; +import React from 'react'; +import type { ConversationColorType } from '../types/Colors'; +import type { LocalizerType } from '../types/Util'; import { formatRelativeTime } from '../util/formatRelativeTime'; export type PropsType = { diff --git a/ts/components/SearchInput.tsx b/ts/components/SearchInput.tsx index 5e4ea9590..64d78aead 100644 --- a/ts/components/SearchInput.tsx +++ b/ts/components/SearchInput.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ChangeEvent, KeyboardEvent, forwardRef } from 'react'; +import type { ChangeEvent, KeyboardEvent } from 'react'; +import React, { forwardRef } from 'react'; import { getClassNamesFor } from '../util/getClassNamesFor'; export type PropTypes = { diff --git a/ts/components/Select.tsx b/ts/components/Select.tsx index 527deec39..5ed7a32d3 100644 --- a/ts/components/Select.tsx +++ b/ts/components/Select.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ChangeEvent } from 'react'; +import type { ChangeEvent } from 'react'; +import React from 'react'; import classNames from 'classnames'; export type Option = Readonly<{ diff --git a/ts/components/SharedGroupNames.tsx b/ts/components/SharedGroupNames.tsx index f076cb699..cdfb526f1 100644 --- a/ts/components/SharedGroupNames.tsx +++ b/ts/components/SharedGroupNames.tsx @@ -1,12 +1,13 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; import { take } from 'lodash'; import { Emojify } from './conversation/Emojify'; import { Intl } from './Intl'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; type PropsType = { i18n: LocalizerType; diff --git a/ts/components/ShortcutGuide.stories.tsx b/ts/components/ShortcutGuide.stories.tsx index 4798ed080..4fe9da46c 100644 --- a/ts/components/ShortcutGuide.stories.tsx +++ b/ts/components/ShortcutGuide.stories.tsx @@ -8,7 +8,8 @@ import { boolean, select } from '@storybook/addon-knobs'; import { setupI18n } from '../util/setupI18n'; import enMessages from '../../_locales/en/messages.json'; -import { Props, ShortcutGuide } from './ShortcutGuide'; +import type { Props } from './ShortcutGuide'; +import { ShortcutGuide } from './ShortcutGuide'; const i18n = setupI18n('en', enMessages); const story = storiesOf('Components/ShortcutGuide', module); diff --git a/ts/components/ShortcutGuide.tsx b/ts/components/ShortcutGuide.tsx index 2b20ed9c3..4924cd057 100644 --- a/ts/components/ShortcutGuide.tsx +++ b/ts/components/ShortcutGuide.tsx @@ -4,7 +4,7 @@ import * as React from 'react'; import classNames from 'classnames'; import { useRestoreFocus } from '../hooks/useRestoreFocus'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type Props = { hasInstalledStickers: boolean; diff --git a/ts/components/ShortcutGuideModal.tsx b/ts/components/ShortcutGuideModal.tsx index 3a75f39c4..066367100 100644 --- a/ts/components/ShortcutGuideModal.tsx +++ b/ts/components/ShortcutGuideModal.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { createPortal } from 'react-dom'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { ShortcutGuide } from './ShortcutGuide'; export type PropsType = { diff --git a/ts/components/Slider.stories.tsx b/ts/components/Slider.stories.tsx index bc788b04c..e251dbd98 100644 --- a/ts/components/Slider.stories.tsx +++ b/ts/components/Slider.stories.tsx @@ -6,7 +6,8 @@ import React, { useState } from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; -import { Slider, PropsType } from './Slider'; +import type { PropsType } from './Slider'; +import { Slider } from './Slider'; const story = storiesOf('Components/Slider', module); diff --git a/ts/components/Slider.tsx b/ts/components/Slider.tsx index e6709d963..d39f270e9 100644 --- a/ts/components/Slider.tsx +++ b/ts/components/Slider.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { CSSProperties, KeyboardEvent, useRef } from 'react'; +import type { CSSProperties, KeyboardEvent } from 'react'; +import React, { useRef } from 'react'; import { getClassNamesFor } from '../util/getClassNamesFor'; export type PropsType = { diff --git a/ts/components/Spinner.stories.tsx b/ts/components/Spinner.stories.tsx index 38bbc1ab0..6acb8e764 100644 --- a/ts/components/Spinner.stories.tsx +++ b/ts/components/Spinner.stories.tsx @@ -5,7 +5,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { select, text } from '@storybook/addon-knobs'; -import { Props, Spinner, SpinnerDirections, SpinnerSvgSizes } from './Spinner'; +import type { Props } from './Spinner'; +import { Spinner, SpinnerDirections, SpinnerSvgSizes } from './Spinner'; const story = storiesOf('Components/Spinner', module); diff --git a/ts/components/StopPropagation.tsx b/ts/components/StopPropagation.tsx index e2d29e372..464e8810d 100644 --- a/ts/components/StopPropagation.tsx +++ b/ts/components/StopPropagation.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; // Whenever you don't want click events to propagate into their parent container export const StopPropagation = ({ diff --git a/ts/components/Tabs.tsx b/ts/components/Tabs.tsx index efe4e0d81..cc5c1ae95 100644 --- a/ts/components/Tabs.tsx +++ b/ts/components/Tabs.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { KeyboardEvent, ReactNode, useState } from 'react'; +import type { KeyboardEvent, ReactNode } from 'react'; +import React, { useState } from 'react'; import classNames from 'classnames'; import { assert } from '../util/assert'; import { getClassNamesFor } from '../util/getClassNamesFor'; diff --git a/ts/components/Toast.tsx b/ts/components/Toast.tsx index c2133e32f..68c7723e0 100644 --- a/ts/components/Toast.tsx +++ b/ts/components/Toast.tsx @@ -1,13 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - KeyboardEvent, - MouseEvent, - ReactNode, - memo, - useEffect, -} from 'react'; +import type { KeyboardEvent, MouseEvent, ReactNode } from 'react'; +import React, { memo, useEffect } from 'react'; import classNames from 'classnames'; import { createPortal } from 'react-dom'; import { useRestoreFocus } from '../hooks/useRestoreFocus'; diff --git a/ts/components/ToastAlreadyGroupMember.tsx b/ts/components/ToastAlreadyGroupMember.tsx index 14dea0935..d3daf626c 100644 --- a/ts/components/ToastAlreadyGroupMember.tsx +++ b/ts/components/ToastAlreadyGroupMember.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastAlreadyRequestedToJoin.tsx b/ts/components/ToastAlreadyRequestedToJoin.tsx index 7d4af2af7..27dc98b54 100644 --- a/ts/components/ToastAlreadyRequestedToJoin.tsx +++ b/ts/components/ToastAlreadyRequestedToJoin.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastBlocked.tsx b/ts/components/ToastBlocked.tsx index fb3d672d3..f952a1a0d 100644 --- a/ts/components/ToastBlocked.tsx +++ b/ts/components/ToastBlocked.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastBlockedGroup.tsx b/ts/components/ToastBlockedGroup.tsx index 75c6795e3..f2c66613d 100644 --- a/ts/components/ToastBlockedGroup.tsx +++ b/ts/components/ToastBlockedGroup.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastCannotMixImageAndNonImageAttachments.tsx b/ts/components/ToastCannotMixImageAndNonImageAttachments.tsx index cb2cf1e74..649088016 100644 --- a/ts/components/ToastCannotMixImageAndNonImageAttachments.tsx +++ b/ts/components/ToastCannotMixImageAndNonImageAttachments.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastCannotStartGroupCall.tsx b/ts/components/ToastCannotStartGroupCall.tsx index 03e2d5e84..d0ea13e79 100644 --- a/ts/components/ToastCannotStartGroupCall.tsx +++ b/ts/components/ToastCannotStartGroupCall.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastCaptchaFailed.tsx b/ts/components/ToastCaptchaFailed.tsx index 94a6b0a90..e9c5e1f6f 100644 --- a/ts/components/ToastCaptchaFailed.tsx +++ b/ts/components/ToastCaptchaFailed.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastCaptchaSolved.tsx b/ts/components/ToastCaptchaSolved.tsx index 746f964c0..6af2b8338 100644 --- a/ts/components/ToastCaptchaSolved.tsx +++ b/ts/components/ToastCaptchaSolved.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastConversationArchived.tsx b/ts/components/ToastConversationArchived.tsx index 1b49047db..6101226a3 100644 --- a/ts/components/ToastConversationArchived.tsx +++ b/ts/components/ToastConversationArchived.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; export type ToastPropsType = { diff --git a/ts/components/ToastConversationMarkedUnread.tsx b/ts/components/ToastConversationMarkedUnread.tsx index eac52083e..bee8807fb 100644 --- a/ts/components/ToastConversationMarkedUnread.tsx +++ b/ts/components/ToastConversationMarkedUnread.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastConversationUnarchived.tsx b/ts/components/ToastConversationUnarchived.tsx index 597cd9352..b06eb4fa2 100644 --- a/ts/components/ToastConversationUnarchived.tsx +++ b/ts/components/ToastConversationUnarchived.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastDangerousFileType.tsx b/ts/components/ToastDangerousFileType.tsx index 8ba015827..466d6b3d2 100644 --- a/ts/components/ToastDangerousFileType.tsx +++ b/ts/components/ToastDangerousFileType.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastDebugLogError.tsx b/ts/components/ToastDebugLogError.tsx index eb8cf316e..29e2443ea 100644 --- a/ts/components/ToastDebugLogError.tsx +++ b/ts/components/ToastDebugLogError.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastDecryptionError.tsx b/ts/components/ToastDecryptionError.tsx index c933205fc..478ff6f60 100644 --- a/ts/components/ToastDecryptionError.tsx +++ b/ts/components/ToastDecryptionError.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; export type ToastPropsType = { diff --git a/ts/components/ToastDeleteForEveryoneFailed.tsx b/ts/components/ToastDeleteForEveryoneFailed.tsx index c97bf3f6c..0def25bb8 100644 --- a/ts/components/ToastDeleteForEveryoneFailed.tsx +++ b/ts/components/ToastDeleteForEveryoneFailed.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastExpired.tsx b/ts/components/ToastExpired.tsx index e817c53cd..e8e4cc03f 100644 --- a/ts/components/ToastExpired.tsx +++ b/ts/components/ToastExpired.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastFileSaved.tsx b/ts/components/ToastFileSaved.tsx index e0da4ccc8..b4878d335 100644 --- a/ts/components/ToastFileSaved.tsx +++ b/ts/components/ToastFileSaved.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; export type ToastPropsType = { diff --git a/ts/components/ToastFileSize.tsx b/ts/components/ToastFileSize.tsx index c3398ac4b..3be93374f 100644 --- a/ts/components/ToastFileSize.tsx +++ b/ts/components/ToastFileSize.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; export type ToastPropsType = { diff --git a/ts/components/ToastGroupLinkCopied.tsx b/ts/components/ToastGroupLinkCopied.tsx index 548bd4870..3b11e8cb9 100644 --- a/ts/components/ToastGroupLinkCopied.tsx +++ b/ts/components/ToastGroupLinkCopied.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastInvalidConversation.tsx b/ts/components/ToastInvalidConversation.tsx index a80e8bbb4..02ee6e9a0 100644 --- a/ts/components/ToastInvalidConversation.tsx +++ b/ts/components/ToastInvalidConversation.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastLeftGroup.tsx b/ts/components/ToastLeftGroup.tsx index 45d27ec4b..32ac1469b 100644 --- a/ts/components/ToastLeftGroup.tsx +++ b/ts/components/ToastLeftGroup.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastLinkCopied.tsx b/ts/components/ToastLinkCopied.tsx index 28eefb6ee..2f1e7170f 100644 --- a/ts/components/ToastLinkCopied.tsx +++ b/ts/components/ToastLinkCopied.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastLoadingFullLogs.tsx b/ts/components/ToastLoadingFullLogs.tsx index dbe197fdb..cf1658ca6 100644 --- a/ts/components/ToastLoadingFullLogs.tsx +++ b/ts/components/ToastLoadingFullLogs.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastMaxAttachments.tsx b/ts/components/ToastMaxAttachments.tsx index 4a5469539..50e3f5f2a 100644 --- a/ts/components/ToastMaxAttachments.tsx +++ b/ts/components/ToastMaxAttachments.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastMessageBodyTooLong.tsx b/ts/components/ToastMessageBodyTooLong.tsx index 53bf6bf8c..48101840b 100644 --- a/ts/components/ToastMessageBodyTooLong.tsx +++ b/ts/components/ToastMessageBodyTooLong.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastOneNonImageAtATime.tsx b/ts/components/ToastOneNonImageAtATime.tsx index 7cad9508d..f68dfb313 100644 --- a/ts/components/ToastOneNonImageAtATime.tsx +++ b/ts/components/ToastOneNonImageAtATime.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastOriginalMessageNotFound.tsx b/ts/components/ToastOriginalMessageNotFound.tsx index a80e66fd6..cc685962b 100644 --- a/ts/components/ToastOriginalMessageNotFound.tsx +++ b/ts/components/ToastOriginalMessageNotFound.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastPinnedConversationsFull.tsx b/ts/components/ToastPinnedConversationsFull.tsx index db8412141..c9399be7c 100644 --- a/ts/components/ToastPinnedConversationsFull.tsx +++ b/ts/components/ToastPinnedConversationsFull.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastReactionFailed.tsx b/ts/components/ToastReactionFailed.tsx index 18a1dcf19..eea3f5eac 100644 --- a/ts/components/ToastReactionFailed.tsx +++ b/ts/components/ToastReactionFailed.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastReportedSpamAndBlocked.tsx b/ts/components/ToastReportedSpamAndBlocked.tsx index 439144921..fc6723e1e 100644 --- a/ts/components/ToastReportedSpamAndBlocked.tsx +++ b/ts/components/ToastReportedSpamAndBlocked.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastStickerPackInstallFailed.tsx b/ts/components/ToastStickerPackInstallFailed.tsx index 2658b07e7..3e2b293fd 100644 --- a/ts/components/ToastStickerPackInstallFailed.tsx +++ b/ts/components/ToastStickerPackInstallFailed.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastTapToViewExpiredIncoming.tsx b/ts/components/ToastTapToViewExpiredIncoming.tsx index 035972322..f52f19801 100644 --- a/ts/components/ToastTapToViewExpiredIncoming.tsx +++ b/ts/components/ToastTapToViewExpiredIncoming.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastTapToViewExpiredOutgoing.tsx b/ts/components/ToastTapToViewExpiredOutgoing.tsx index 123a17767..505cd6ac6 100644 --- a/ts/components/ToastTapToViewExpiredOutgoing.tsx +++ b/ts/components/ToastTapToViewExpiredOutgoing.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastUnableToLoadAttachment.tsx b/ts/components/ToastUnableToLoadAttachment.tsx index 17b59b179..91671158e 100644 --- a/ts/components/ToastUnableToLoadAttachment.tsx +++ b/ts/components/ToastUnableToLoadAttachment.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastVoiceNoteError.tsx b/ts/components/ToastVoiceNoteError.tsx index b7eca4000..70b5b1db7 100644 --- a/ts/components/ToastVoiceNoteError.tsx +++ b/ts/components/ToastVoiceNoteError.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastVoiceNoteLimit.tsx b/ts/components/ToastVoiceNoteLimit.tsx index 320ded066..b268a9e00 100644 --- a/ts/components/ToastVoiceNoteLimit.tsx +++ b/ts/components/ToastVoiceNoteLimit.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/ToastVoiceNoteMustBeOnlyAttachment.tsx b/ts/components/ToastVoiceNoteMustBeOnlyAttachment.tsx index cbe1db9ba..ec2fe8b83 100644 --- a/ts/components/ToastVoiceNoteMustBeOnlyAttachment.tsx +++ b/ts/components/ToastVoiceNoteMustBeOnlyAttachment.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { Toast } from './Toast'; type PropsType = { diff --git a/ts/components/Tooltip.stories.tsx b/ts/components/Tooltip.stories.tsx index f60cb23d7..083bf5150 100644 --- a/ts/components/Tooltip.stories.tsx +++ b/ts/components/Tooltip.stories.tsx @@ -5,7 +5,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { select } from '@storybook/addon-knobs'; -import { Tooltip, TooltipPlacement, PropsType } from './Tooltip'; +import type { PropsType } from './Tooltip'; +import { Tooltip, TooltipPlacement } from './Tooltip'; import { Theme } from '../util/theme'; const createProps = (overrideProps: Partial = {}): PropsType => ({ diff --git a/ts/components/Tooltip.tsx b/ts/components/Tooltip.tsx index 4ccba759e..9daf61ab0 100644 --- a/ts/components/Tooltip.tsx +++ b/ts/components/Tooltip.tsx @@ -6,7 +6,8 @@ import classNames from 'classnames'; import { noop } from 'lodash'; import { Manager, Reference, Popper } from 'react-popper'; import type { StrictModifiers } from '@popperjs/core'; -import { Theme, themeClassName } from '../util/theme'; +import type { Theme } from '../util/theme'; +import { themeClassName } from '../util/theme'; import { refMerger } from '../util/refMerger'; import { offsetDistanceModifier } from '../util/popperUtil'; diff --git a/ts/components/WhatsNewLink.tsx b/ts/components/WhatsNewLink.tsx index 15eb0119e..53f8729d2 100644 --- a/ts/components/WhatsNewLink.tsx +++ b/ts/components/WhatsNewLink.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { Intl } from './Intl'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/WhatsNewModal.tsx b/ts/components/WhatsNewModal.tsx index 2cfab8c5f..048544bce 100644 --- a/ts/components/WhatsNewModal.tsx +++ b/ts/components/WhatsNewModal.tsx @@ -1,11 +1,13 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild } from 'react'; +import type { ReactChild } from 'react'; +import React from 'react'; import moment from 'moment'; import { Modal } from './Modal'; -import { Intl, IntlComponentsType } from './Intl'; +import type { IntlComponentsType } from './Intl'; +import { Intl } from './Intl'; import { Emojify } from './conversation/Emojify'; import type { LocalizerType, RenderTextCallbackType } from '../types/Util'; diff --git a/ts/components/conversation/AddNewLines.stories.tsx b/ts/components/conversation/AddNewLines.stories.tsx index db11fb225..3e8d1dfc1 100644 --- a/ts/components/conversation/AddNewLines.stories.tsx +++ b/ts/components/conversation/AddNewLines.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { AddNewLines, Props } from './AddNewLines'; +import type { Props } from './AddNewLines'; +import { AddNewLines } from './AddNewLines'; const story = storiesOf('Components/Conversation/AddNewLines', module); const createProps = (overrideProps: Partial = {}): Props => ({ diff --git a/ts/components/conversation/AddNewLines.tsx b/ts/components/conversation/AddNewLines.tsx index fd9183467..b626b2c12 100644 --- a/ts/components/conversation/AddNewLines.tsx +++ b/ts/components/conversation/AddNewLines.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { RenderTextCallbackType } from '../../types/Util'; +import type { RenderTextCallbackType } from '../../types/Util'; export type Props = { text: string; diff --git a/ts/components/conversation/AtMentionify.stories.tsx b/ts/components/conversation/AtMentionify.stories.tsx index e90998b4f..865278442 100644 --- a/ts/components/conversation/AtMentionify.stories.tsx +++ b/ts/components/conversation/AtMentionify.stories.tsx @@ -7,7 +7,8 @@ import { action } from '@storybook/addon-actions'; import { select, text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { AtMentionify, Props } from './AtMentionify'; +import type { Props } from './AtMentionify'; +import { AtMentionify } from './AtMentionify'; const story = storiesOf('Components/Conversation/AtMentionify', module); diff --git a/ts/components/conversation/AtMentionify.tsx b/ts/components/conversation/AtMentionify.tsx index 877d0074b..82501064e 100644 --- a/ts/components/conversation/AtMentionify.tsx +++ b/ts/components/conversation/AtMentionify.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { sortBy } from 'lodash'; import { Emojify } from './Emojify'; -import { BodyRangesType } from '../../types/Util'; +import type { BodyRangesType } from '../../types/Util'; export type Props = { bodyRanges?: BodyRangesType; diff --git a/ts/components/conversation/AttachmentList.stories.tsx b/ts/components/conversation/AttachmentList.stories.tsx index 709174b20..6c1341701 100644 --- a/ts/components/conversation/AttachmentList.stories.tsx +++ b/ts/components/conversation/AttachmentList.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; -import { AttachmentList, Props } from './AttachmentList'; +import type { Props } from './AttachmentList'; +import { AttachmentList } from './AttachmentList'; import { AUDIO_MP3, IMAGE_GIF, diff --git a/ts/components/conversation/AttachmentList.tsx b/ts/components/conversation/AttachmentList.tsx index 6ed600212..d6da9b31b 100644 --- a/ts/components/conversation/AttachmentList.tsx +++ b/ts/components/conversation/AttachmentList.tsx @@ -6,10 +6,10 @@ import React from 'react'; import { Image } from './Image'; import { StagedGenericAttachment } from './StagedGenericAttachment'; import { StagedPlaceholderAttachment } from './StagedPlaceholderAttachment'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; +import type { AttachmentType } from '../../types/Attachment'; import { areAllAttachmentsVisual, - AttachmentType, getUrl, isImageAttachment, isVideoAttachment, diff --git a/ts/components/conversation/AudioCapture.stories.tsx b/ts/components/conversation/AudioCapture.stories.tsx index 1866b53bd..fe9b3e38d 100644 --- a/ts/components/conversation/AudioCapture.stories.tsx +++ b/ts/components/conversation/AudioCapture.stories.tsx @@ -8,7 +8,8 @@ import { storiesOf } from '@storybook/react'; import { boolean } from '@storybook/addon-knobs'; import { ErrorDialogAudioRecorderType } from '../../state/ducks/audioRecorder'; -import { AudioCapture, PropsType } from './AudioCapture'; +import type { PropsType } from './AudioCapture'; +import { AudioCapture } from './AudioCapture'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/AudioCapture.tsx b/ts/components/conversation/AudioCapture.tsx index cc67ba2ce..03cf3db07 100644 --- a/ts/components/conversation/AudioCapture.tsx +++ b/ts/components/conversation/AudioCapture.tsx @@ -5,9 +5,9 @@ import React, { useCallback, useEffect, useState } from 'react'; import * as moment from 'moment'; import { noop } from 'lodash'; -import { AttachmentType } from '../../types/Attachment'; +import type { AttachmentType } from '../../types/Attachment'; import { ConfirmationDialog } from '../ConfirmationDialog'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { ErrorDialogAudioRecorderType } from '../../state/ducks/audioRecorder'; import { ToastVoiceNoteLimit } from '../ToastVoiceNoteLimit'; import { ToastVoiceNoteMustBeOnlyAttachment } from '../ToastVoiceNoteMustBeOnlyAttachment'; diff --git a/ts/components/conversation/CallingNotification.tsx b/ts/components/conversation/CallingNotification.tsx index 50d72a6e2..8b606c084 100644 --- a/ts/components/conversation/CallingNotification.tsx +++ b/ts/components/conversation/CallingNotification.tsx @@ -1,17 +1,18 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode, useState, useEffect } from 'react'; +import type { ReactNode } from 'react'; +import React, { useState, useEffect } from 'react'; import Measure from 'react-measure'; import { noop } from 'lodash'; import { SystemMessage } from './SystemMessage'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { Timestamp } from './Timestamp'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { CallMode } from '../../types/Calling'; +import type { CallingNotificationType } from '../../util/callingNotification'; import { - CallingNotificationType, getCallingIcon, getCallingNotificationText, } from '../../util/callingNotification'; diff --git a/ts/components/conversation/ChangeNumberNotification.tsx b/ts/components/conversation/ChangeNumberNotification.tsx index b24ff6fc5..efcabcd4f 100644 --- a/ts/components/conversation/ChangeNumberNotification.tsx +++ b/ts/components/conversation/ChangeNumberNotification.tsx @@ -3,8 +3,8 @@ import React from 'react'; -import { ConversationType } from '../../state/ducks/conversations'; -import { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; import { Intl } from '../Intl'; import { SystemMessage } from './SystemMessage'; diff --git a/ts/components/conversation/ChatSessionRefreshedDialog.tsx b/ts/components/conversation/ChatSessionRefreshedDialog.tsx index f178e6d40..5e6ac88bc 100644 --- a/ts/components/conversation/ChatSessionRefreshedDialog.tsx +++ b/ts/components/conversation/ChatSessionRefreshedDialog.tsx @@ -8,7 +8,7 @@ import { Modal } from '../Modal'; import { useRestoreFocus } from '../../hooks/useRestoreFocus'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/conversation/ChatSessionRefreshedNotification.tsx b/ts/components/conversation/ChatSessionRefreshedNotification.tsx index a9e67a46a..2331d74c6 100644 --- a/ts/components/conversation/ChatSessionRefreshedNotification.tsx +++ b/ts/components/conversation/ChatSessionRefreshedNotification.tsx @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useCallback, useState, ReactElement } from 'react'; +import type { ReactElement } from 'react'; +import React, { useCallback, useState } from 'react'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { SystemMessage } from './SystemMessage'; diff --git a/ts/components/conversation/ContactDetail.stories.tsx b/ts/components/conversation/ContactDetail.stories.tsx index abf807d75..a5bbfceaa 100644 --- a/ts/components/conversation/ContactDetail.stories.tsx +++ b/ts/components/conversation/ContactDetail.stories.tsx @@ -7,7 +7,8 @@ import { action } from '@storybook/addon-actions'; import { boolean } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { ContactDetail, Props } from './ContactDetail'; +import type { Props } from './ContactDetail'; +import { ContactDetail } from './ContactDetail'; import { AddressType, ContactFormType } from '../../types/EmbeddedContact'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/ContactDetail.tsx b/ts/components/conversation/ContactDetail.tsx index 1074e972e..1b01b2680 100644 --- a/ts/components/conversation/ContactDetail.tsx +++ b/ts/components/conversation/ContactDetail.tsx @@ -3,14 +3,13 @@ import React from 'react'; -import { - AddressType, - ContactFormType, +import type { EmbeddedContactType, Email, Phone, PostalAddress, } from '../../types/EmbeddedContact'; +import { AddressType, ContactFormType } from '../../types/EmbeddedContact'; import { missingCaseError } from '../../util/missingCaseError'; import { @@ -19,7 +18,7 @@ import { renderName, } from './_contactUtil'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type Props = { contact: EmbeddedContactType; diff --git a/ts/components/conversation/ContactModal.stories.tsx b/ts/components/conversation/ContactModal.stories.tsx index c40755667..927faa5a8 100644 --- a/ts/components/conversation/ContactModal.stories.tsx +++ b/ts/components/conversation/ContactModal.stories.tsx @@ -8,10 +8,11 @@ import { boolean } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; -import { ContactModal, PropsType } from './ContactModal'; +import type { PropsType } from './ContactModal'; +import { ContactModal } from './ContactModal'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/ContactModal.tsx b/ts/components/conversation/ContactModal.tsx index 02844effe..4465e080f 100644 --- a/ts/components/conversation/ContactModal.tsx +++ b/ts/components/conversation/ContactModal.tsx @@ -6,9 +6,9 @@ import React, { useEffect, useState } from 'react'; import { About } from './About'; import { Avatar } from '../Avatar'; import { AvatarLightbox } from '../AvatarLightbox'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import { Modal } from '../Modal'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { SharedGroupNames } from '../SharedGroupNames'; import { ConfirmationDialog } from '../ConfirmationDialog'; diff --git a/ts/components/conversation/ContactName.tsx b/ts/components/conversation/ContactName.tsx index 31e77d9c7..230fe76fa 100644 --- a/ts/components/conversation/ContactName.tsx +++ b/ts/components/conversation/ContactName.tsx @@ -5,7 +5,7 @@ import React from 'react'; import classNames from 'classnames'; import { Emojify } from './Emojify'; -import { ContactNameColorType } from '../../types/Colors'; +import type { ContactNameColorType } from '../../types/Colors'; import { getClassNamesFor } from '../../util/getClassNamesFor'; export type PropsType = { diff --git a/ts/components/conversation/ContactSpoofingReviewDialog.tsx b/ts/components/conversation/ContactSpoofingReviewDialog.tsx index 775589d33..6b21aab57 100644 --- a/ts/components/conversation/ContactSpoofingReviewDialog.tsx +++ b/ts/components/conversation/ContactSpoofingReviewDialog.tsx @@ -1,16 +1,12 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - FunctionComponent, - ReactChild, - ReactNode, - useState, -} from 'react'; +import type { FunctionComponent, ReactChild, ReactNode } from 'react'; +import React, { useState } from 'react'; import { concat, orderBy } from 'lodash'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; import { MessageRequestActionsConfirmation, MessageRequestState, diff --git a/ts/components/conversation/ContactSpoofingReviewDialogPerson.tsx b/ts/components/conversation/ContactSpoofingReviewDialogPerson.tsx index a535c4ddd..609a992b2 100644 --- a/ts/components/conversation/ContactSpoofingReviewDialogPerson.tsx +++ b/ts/components/conversation/ContactSpoofingReviewDialogPerson.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React from 'react'; -import { ConversationType } from '../../state/ducks/conversations'; -import { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; import { assert } from '../../util/assert'; import { Avatar, AvatarSize } from '../Avatar'; diff --git a/ts/components/conversation/ConversationHeader.stories.tsx b/ts/components/conversation/ConversationHeader.stories.tsx index f04876f3a..1ce5644b4 100644 --- a/ts/components/conversation/ConversationHeader.stories.tsx +++ b/ts/components/conversation/ConversationHeader.stories.tsx @@ -1,7 +1,8 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ComponentProps } from 'react'; +import type { ComponentProps } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; diff --git a/ts/components/conversation/ConversationHeader.tsx b/ts/components/conversation/ConversationHeader.tsx index 1efaba9dd..6e43b9c3f 100644 --- a/ts/components/conversation/ConversationHeader.tsx +++ b/ts/components/conversation/ConversationHeader.tsx @@ -1,7 +1,8 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; import Measure from 'react-measure'; import classNames from 'classnames'; import { @@ -16,8 +17,8 @@ import { DisappearingTimeDialog } from '../DisappearingTimeDialog'; import { Avatar, AvatarSize } from '../Avatar'; import { InContactsIcon } from '../InContactsIcon'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; import { getMuteOptions } from '../../util/getMuteOptions'; import * as expirationTimer from '../../util/expirationTimer'; import { missingCaseError } from '../../util/missingCaseError'; diff --git a/ts/components/conversation/ConversationHero.tsx b/ts/components/conversation/ConversationHero.tsx index 2b3f5f9f1..28d408f30 100644 --- a/ts/components/conversation/ConversationHero.tsx +++ b/ts/components/conversation/ConversationHero.tsx @@ -2,12 +2,13 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useEffect, useRef, useState } from 'react'; -import { Avatar, AvatarBlur, Props as AvatarProps } from '../Avatar'; +import type { Props as AvatarProps } from '../Avatar'; +import { Avatar, AvatarBlur } from '../Avatar'; import { ContactName } from './ContactName'; import { About } from './About'; import { GroupDescription } from './GroupDescription'; import { SharedGroupNames } from '../SharedGroupNames'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { ConfirmationDialog } from '../ConfirmationDialog'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { shouldBlurAvatar } from '../../util/shouldBlurAvatar'; diff --git a/ts/components/conversation/DeliveryIssueDialog.tsx b/ts/components/conversation/DeliveryIssueDialog.tsx index b78392042..688b28a46 100644 --- a/ts/components/conversation/DeliveryIssueDialog.tsx +++ b/ts/components/conversation/DeliveryIssueDialog.tsx @@ -4,14 +4,14 @@ import * as React from 'react'; import { Button, ButtonSize, ButtonVariant } from '../Button'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import { Modal } from '../Modal'; import { Intl } from '../Intl'; import { Emojify } from './Emojify'; import { useRestoreFocus } from '../../hooks/useRestoreFocus'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/conversation/DeliveryIssueNotification.tsx b/ts/components/conversation/DeliveryIssueNotification.tsx index 0c4f4ba06..0c98fc4b4 100644 --- a/ts/components/conversation/DeliveryIssueNotification.tsx +++ b/ts/components/conversation/DeliveryIssueNotification.tsx @@ -1,12 +1,13 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useCallback, useState, ReactElement } from 'react'; +import type { ReactElement } from 'react'; +import React, { useCallback, useState } from 'react'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { SystemMessage } from './SystemMessage'; -import { ConversationType } from '../../state/ducks/conversations'; -import { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; import { Intl } from '../Intl'; import { Emojify } from './Emojify'; diff --git a/ts/components/conversation/EmbeddedContact.stories.tsx b/ts/components/conversation/EmbeddedContact.stories.tsx index b688c3f65..0dff799fe 100644 --- a/ts/components/conversation/EmbeddedContact.stories.tsx +++ b/ts/components/conversation/EmbeddedContact.stories.tsx @@ -7,7 +7,8 @@ import { action } from '@storybook/addon-actions'; import { boolean, number } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { EmbeddedContact, Props } from './EmbeddedContact'; +import type { Props } from './EmbeddedContact'; +import { EmbeddedContact } from './EmbeddedContact'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; import { ContactFormType } from '../../types/EmbeddedContact'; diff --git a/ts/components/conversation/EmbeddedContact.tsx b/ts/components/conversation/EmbeddedContact.tsx index 47c1f8aae..7cf104114 100644 --- a/ts/components/conversation/EmbeddedContact.tsx +++ b/ts/components/conversation/EmbeddedContact.tsx @@ -4,9 +4,9 @@ import React from 'react'; import classNames from 'classnames'; -import { EmbeddedContactType } from '../../types/EmbeddedContact'; +import type { EmbeddedContactType } from '../../types/EmbeddedContact'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { renderAvatar, renderContactShorthand, diff --git a/ts/components/conversation/Emojify.stories.tsx b/ts/components/conversation/Emojify.stories.tsx index 2d0c304b5..1a34bd6ed 100644 --- a/ts/components/conversation/Emojify.stories.tsx +++ b/ts/components/conversation/Emojify.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { Emojify, Props } from './Emojify'; +import type { Props } from './Emojify'; +import { Emojify } from './Emojify'; const story = storiesOf('Components/Conversation/Emojify', module); diff --git a/ts/components/conversation/Emojify.tsx b/ts/components/conversation/Emojify.tsx index 8af5fe50c..9c2da353e 100644 --- a/ts/components/conversation/Emojify.tsx +++ b/ts/components/conversation/Emojify.tsx @@ -5,10 +5,11 @@ import React from 'react'; import classNames from 'classnames'; -import { RenderTextCallbackType } from '../../types/Util'; +import type { RenderTextCallbackType } from '../../types/Util'; import { splitByEmoji } from '../../util/emoji'; import { missingCaseError } from '../../util/missingCaseError'; -import { emojiToImage, SizeClassType } from '../emoji/lib'; +import type { SizeClassType } from '../emoji/lib'; +import { emojiToImage } from '../emoji/lib'; // Some of this logic taken from emoji-js/replacement // the DOM structure for this getImageTag should match the other emoji implementations: diff --git a/ts/components/conversation/ErrorBoundary.tsx b/ts/components/conversation/ErrorBoundary.tsx index f6b46a32e..ab56d3230 100644 --- a/ts/components/conversation/ErrorBoundary.tsx +++ b/ts/components/conversation/ErrorBoundary.tsx @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import * as Errors from '../../types/errors'; import * as log from '../../logging/log'; diff --git a/ts/components/conversation/ExpireTimer.stories.tsx b/ts/components/conversation/ExpireTimer.stories.tsx index 4e002560c..24655a8de 100644 --- a/ts/components/conversation/ExpireTimer.stories.tsx +++ b/ts/components/conversation/ExpireTimer.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { boolean, number } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { ExpireTimer, Props } from './ExpireTimer'; +import type { Props } from './ExpireTimer'; +import { ExpireTimer } from './ExpireTimer'; const story = storiesOf('Components/Conversation/ExpireTimer', module); diff --git a/ts/components/conversation/GIF.tsx b/ts/components/conversation/GIF.tsx index 34d0b6c57..cab70bffb 100644 --- a/ts/components/conversation/GIF.tsx +++ b/ts/components/conversation/GIF.tsx @@ -5,11 +5,11 @@ import React, { useRef, useState, useEffect } from 'react'; import classNames from 'classnames'; import { Blurhash } from 'react-blurhash'; -import { LocalizerType, ThemeType } from '../../types/Util'; +import type { LocalizerType, ThemeType } from '../../types/Util'; import { Spinner } from '../Spinner'; +import type { AttachmentType } from '../../types/Attachment'; import { - AttachmentType, hasNotDownloaded, getImageDimensions, defaultBlurHash, diff --git a/ts/components/conversation/GroupDescription.stories.tsx b/ts/components/conversation/GroupDescription.stories.tsx index c584c2149..3fd06e4ed 100644 --- a/ts/components/conversation/GroupDescription.stories.tsx +++ b/ts/components/conversation/GroupDescription.stories.tsx @@ -6,7 +6,8 @@ import React from 'react'; import { text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { GroupDescription, PropsType } from './GroupDescription'; +import type { PropsType } from './GroupDescription'; +import { GroupDescription } from './GroupDescription'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/GroupDescription.tsx b/ts/components/conversation/GroupDescription.tsx index 86bc4a460..fa7bb84ab 100644 --- a/ts/components/conversation/GroupDescription.tsx +++ b/ts/components/conversation/GroupDescription.tsx @@ -3,7 +3,7 @@ import React, { useEffect, useRef, useState } from 'react'; import { Modal } from '../Modal'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { GroupDescriptionText } from '../GroupDescriptionText'; // Emojification can cause the scroll height to be *slightly* larger than the client diff --git a/ts/components/conversation/GroupNotification.stories.tsx b/ts/components/conversation/GroupNotification.stories.tsx index b6c27de44..0ab00d767 100644 --- a/ts/components/conversation/GroupNotification.stories.tsx +++ b/ts/components/conversation/GroupNotification.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { GroupNotification, Props } from './GroupNotification'; +import type { Props } from './GroupNotification'; +import { GroupNotification } from './GroupNotification'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; const book = storiesOf('Components/Conversation', module); diff --git a/ts/components/conversation/GroupNotification.tsx b/ts/components/conversation/GroupNotification.tsx index 58fd1df13..92258b58e 100644 --- a/ts/components/conversation/GroupNotification.tsx +++ b/ts/components/conversation/GroupNotification.tsx @@ -1,16 +1,17 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; import { compact, flatten } from 'lodash'; import { ContactName } from './ContactName'; import { SystemMessage } from './SystemMessage'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { missingCaseError } from '../../util/missingCaseError'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; export type ChangeType = 'add' | 'remove' | 'name' | 'avatar' | 'general'; diff --git a/ts/components/conversation/GroupV1DisabledActions.stories.tsx b/ts/components/conversation/GroupV1DisabledActions.stories.tsx index ec05023d7..c10ec10f0 100644 --- a/ts/components/conversation/GroupV1DisabledActions.stories.tsx +++ b/ts/components/conversation/GroupV1DisabledActions.stories.tsx @@ -5,10 +5,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; -import { - GroupV1DisabledActions, - PropsType as GroupV1DisabledActionsPropsType, -} from './GroupV1DisabledActions'; +import type { PropsType as GroupV1DisabledActionsPropsType } from './GroupV1DisabledActions'; +import { GroupV1DisabledActions } from './GroupV1DisabledActions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/GroupV1DisabledActions.tsx b/ts/components/conversation/GroupV1DisabledActions.tsx index 128f56ee6..c0436d217 100644 --- a/ts/components/conversation/GroupV1DisabledActions.tsx +++ b/ts/components/conversation/GroupV1DisabledActions.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/conversation/GroupV1Migration.stories.tsx b/ts/components/conversation/GroupV1Migration.stories.tsx index 86a263b04..4dad49fb4 100644 --- a/ts/components/conversation/GroupV1Migration.stories.tsx +++ b/ts/components/conversation/GroupV1Migration.stories.tsx @@ -10,7 +10,8 @@ import { boolean } from '@storybook/addon-knobs'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { GroupV1Migration, PropsType } from './GroupV1Migration'; +import type { PropsType } from './GroupV1Migration'; +import { GroupV1Migration } from './GroupV1Migration'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/GroupV1Migration.tsx b/ts/components/conversation/GroupV1Migration.tsx index e746e25c9..9ea3f761d 100644 --- a/ts/components/conversation/GroupV1Migration.tsx +++ b/ts/components/conversation/GroupV1Migration.tsx @@ -5,8 +5,8 @@ import * as React from 'react'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { SystemMessage } from './SystemMessage'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; import { Intl } from '../Intl'; import { ContactName } from './ContactName'; import { GroupV1MigrationDialog } from '../GroupV1MigrationDialog'; diff --git a/ts/components/conversation/GroupV2Change.stories.tsx b/ts/components/conversation/GroupV2Change.stories.tsx index 676e714d7..c16d96c76 100644 --- a/ts/components/conversation/GroupV2Change.stories.tsx +++ b/ts/components/conversation/GroupV2Change.stories.tsx @@ -7,9 +7,9 @@ import { storiesOf } from '@storybook/react'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { GroupV2ChangeType } from '../../groups'; +import type { GroupV2ChangeType } from '../../groups'; import { SignalService as Proto } from '../../protobuf'; -import { SmartContactRendererType } from '../../groupChange'; +import type { SmartContactRendererType } from '../../groupChange'; import { GroupV2Change } from './GroupV2Change'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/GroupV2Change.tsx b/ts/components/conversation/GroupV2Change.tsx index 1f4b18767..57ed9641d 100644 --- a/ts/components/conversation/GroupV2Change.tsx +++ b/ts/components/conversation/GroupV2Change.tsx @@ -1,19 +1,22 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactElement, useState } from 'react'; +import type { ReactElement } from 'react'; +import React, { useState } from 'react'; import { get } from 'lodash'; -import { ReplacementValuesType } from '../../types/I18N'; -import { FullJSXType, Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { ReplacementValuesType } from '../../types/I18N'; +import type { FullJSXType } from '../Intl'; +import { Intl } from '../Intl'; +import type { LocalizerType } from '../../types/Util'; import { GroupDescriptionText } from '../GroupDescriptionText'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { SystemMessage } from './SystemMessage'; -import { GroupV2ChangeType, GroupV2ChangeDetailType } from '../../groups'; +import type { GroupV2ChangeType, GroupV2ChangeDetailType } from '../../groups'; -import { renderChange, SmartContactRendererType } from '../../groupChange'; +import type { SmartContactRendererType } from '../../groupChange'; +import { renderChange } from '../../groupChange'; import { Modal } from '../Modal'; export type PropsDataType = { diff --git a/ts/components/conversation/GroupV2PendingApprovalActions.stories.tsx b/ts/components/conversation/GroupV2PendingApprovalActions.stories.tsx index be8819859..d0926ca4a 100644 --- a/ts/components/conversation/GroupV2PendingApprovalActions.stories.tsx +++ b/ts/components/conversation/GroupV2PendingApprovalActions.stories.tsx @@ -5,10 +5,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; -import { - GroupV2PendingApprovalActions, - PropsType as GroupV2PendingApprovalActionsPropsType, -} from './GroupV2PendingApprovalActions'; +import type { PropsType as GroupV2PendingApprovalActionsPropsType } from './GroupV2PendingApprovalActions'; +import { GroupV2PendingApprovalActions } from './GroupV2PendingApprovalActions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/GroupV2PendingApprovalActions.tsx b/ts/components/conversation/GroupV2PendingApprovalActions.tsx index 52611164f..eebb26ce5 100644 --- a/ts/components/conversation/GroupV2PendingApprovalActions.tsx +++ b/ts/components/conversation/GroupV2PendingApprovalActions.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type PropsType = { i18n: LocalizerType; diff --git a/ts/components/conversation/Image.stories.tsx b/ts/components/conversation/Image.stories.tsx index b45d4a2cc..b243e28fc 100644 --- a/ts/components/conversation/Image.stories.tsx +++ b/ts/components/conversation/Image.stories.tsx @@ -8,7 +8,8 @@ import { boolean, number, text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; import { pngUrl } from '../../storybook/Fixtures'; -import { Image, Props } from './Image'; +import type { Props } from './Image'; +import { Image } from './Image'; import { IMAGE_PNG } from '../../types/MIME'; import { ThemeType } from '../../types/Util'; import { setupI18n } from '../../util/setupI18n'; diff --git a/ts/components/conversation/Image.tsx b/ts/components/conversation/Image.tsx index 071a7f497..7be98db09 100644 --- a/ts/components/conversation/Image.tsx +++ b/ts/components/conversation/Image.tsx @@ -6,12 +6,9 @@ import classNames from 'classnames'; import { Blurhash } from 'react-blurhash'; import { Spinner } from '../Spinner'; -import { LocalizerType, ThemeType } from '../../types/Util'; -import { - AttachmentType, - hasNotDownloaded, - defaultBlurHash, -} from '../../types/Attachment'; +import type { LocalizerType, ThemeType } from '../../types/Util'; +import type { AttachmentType } from '../../types/Attachment'; +import { hasNotDownloaded, defaultBlurHash } from '../../types/Attachment'; export type Props = { alt: string; diff --git a/ts/components/conversation/ImageGrid.stories.tsx b/ts/components/conversation/ImageGrid.stories.tsx index 78f49f3c0..190fa7c8e 100644 --- a/ts/components/conversation/ImageGrid.stories.tsx +++ b/ts/components/conversation/ImageGrid.stories.tsx @@ -7,7 +7,8 @@ import { action } from '@storybook/addon-actions'; import { boolean, number } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { ImageGrid, Props } from './ImageGrid'; +import type { Props } from './ImageGrid'; +import { ImageGrid } from './ImageGrid'; import { AUDIO_MP3, IMAGE_JPEG, diff --git a/ts/components/conversation/ImageGrid.tsx b/ts/components/conversation/ImageGrid.tsx index 83e122c2b..66caacf26 100644 --- a/ts/components/conversation/ImageGrid.tsx +++ b/ts/components/conversation/ImageGrid.tsx @@ -4,9 +4,9 @@ import React from 'react'; import classNames from 'classnames'; +import type { AttachmentType } from '../../types/Attachment'; import { areAllAttachmentsVisual, - AttachmentType, getAlt, getImageDimensions, getThumbnailUrl, @@ -16,7 +16,7 @@ import { import { Image } from './Image'; -import { LocalizerType, ThemeType } from '../../types/Util'; +import type { LocalizerType, ThemeType } from '../../types/Util'; export type Props = { attachments: Array; diff --git a/ts/components/conversation/LastSeenIndicator.stories.tsx b/ts/components/conversation/LastSeenIndicator.stories.tsx index 198128ece..b14f08b55 100644 --- a/ts/components/conversation/LastSeenIndicator.stories.tsx +++ b/ts/components/conversation/LastSeenIndicator.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { number } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { LastSeenIndicator, Props } from './LastSeenIndicator'; +import type { Props } from './LastSeenIndicator'; +import { LastSeenIndicator } from './LastSeenIndicator'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/LastSeenIndicator.tsx b/ts/components/conversation/LastSeenIndicator.tsx index c42ca3029..d6932dddb 100644 --- a/ts/components/conversation/LastSeenIndicator.tsx +++ b/ts/components/conversation/LastSeenIndicator.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type Props = { count: number; diff --git a/ts/components/conversation/LinkPreviewDate.tsx b/ts/components/conversation/LinkPreviewDate.tsx index 277b85bf8..835f5c847 100644 --- a/ts/components/conversation/LinkPreviewDate.tsx +++ b/ts/components/conversation/LinkPreviewDate.tsx @@ -2,7 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import moment, { Moment } from 'moment'; +import type { Moment } from 'moment'; +import moment from 'moment'; import { isLinkPreviewDateValid } from '../../linkPreviews/isLinkPreviewDateValid'; type Props = { diff --git a/ts/components/conversation/Linkify.stories.tsx b/ts/components/conversation/Linkify.stories.tsx index 6f3fce3e0..76f52e544 100644 --- a/ts/components/conversation/Linkify.stories.tsx +++ b/ts/components/conversation/Linkify.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { Linkify, Props } from './Linkify'; +import type { Props } from './Linkify'; +import { Linkify } from './Linkify'; const story = storiesOf('Components/Conversation/Linkify', module); diff --git a/ts/components/conversation/Linkify.tsx b/ts/components/conversation/Linkify.tsx index b9c041239..aefa236ae 100644 --- a/ts/components/conversation/Linkify.tsx +++ b/ts/components/conversation/Linkify.tsx @@ -5,7 +5,7 @@ import React from 'react'; import LinkifyIt from 'linkify-it'; -import { RenderTextCallbackType } from '../../types/Util'; +import type { RenderTextCallbackType } from '../../types/Util'; import { isLinkSneaky } from '../../types/LinkPreview'; import { splitByEmoji } from '../../util/emoji'; import { missingCaseError } from '../../util/missingCaseError'; diff --git a/ts/components/conversation/MandatoryProfileSharingActions.stories.tsx b/ts/components/conversation/MandatoryProfileSharingActions.stories.tsx index 286476e45..9784f1f4d 100644 --- a/ts/components/conversation/MandatoryProfileSharingActions.stories.tsx +++ b/ts/components/conversation/MandatoryProfileSharingActions.stories.tsx @@ -6,10 +6,8 @@ import { storiesOf } from '@storybook/react'; import { text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { - MandatoryProfileSharingActions, - Props as MandatoryProfileSharingActionsProps, -} from './MandatoryProfileSharingActions'; +import type { Props as MandatoryProfileSharingActionsProps } from './MandatoryProfileSharingActions'; +import { MandatoryProfileSharingActions } from './MandatoryProfileSharingActions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/MandatoryProfileSharingActions.tsx b/ts/components/conversation/MandatoryProfileSharingActions.tsx index 9606c21e2..04adee612 100644 --- a/ts/components/conversation/MandatoryProfileSharingActions.tsx +++ b/ts/components/conversation/MandatoryProfileSharingActions.tsx @@ -2,15 +2,16 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { ContactName, PropsType as ContactNameProps } from './ContactName'; +import type { PropsType as ContactNameProps } from './ContactName'; +import { ContactName } from './ContactName'; import { Button, ButtonVariant } from '../Button'; +import type { Props as MessageRequestActionsConfirmationProps } from './MessageRequestActionsConfirmation'; import { MessageRequestActionsConfirmation, MessageRequestState, - Props as MessageRequestActionsConfirmationProps, } from './MessageRequestActionsConfirmation'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type Props = { i18n: LocalizerType; diff --git a/ts/components/conversation/Message.stories.tsx b/ts/components/conversation/Message.stories.tsx index 74d5c509e..a3b33ffac 100644 --- a/ts/components/conversation/Message.stories.tsx +++ b/ts/components/conversation/Message.stories.tsx @@ -11,7 +11,8 @@ import { storiesOf } from '@storybook/react'; import { SignalService } from '../../protobuf'; import { ConversationColors } from '../../types/Colors'; import { EmojiPicker } from '../emoji/EmojiPicker'; -import { Message, Props, AudioAttachmentProps } from './Message'; +import type { Props, AudioAttachmentProps } from './Message'; +import { Message } from './Message'; import { AUDIO_MP3, IMAGE_JPEG, diff --git a/ts/components/conversation/Message.tsx b/ts/components/conversation/Message.tsx index 9dd2299d3..1d54fcc93 100644 --- a/ts/components/conversation/Message.tsx +++ b/ts/components/conversation/Message.tsx @@ -1,7 +1,8 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { RefObject } from 'react'; +import type { RefObject } from 'react'; +import React from 'react'; import ReactDOM, { createPortal } from 'react-dom'; import classNames from 'classnames'; import { drop, groupBy, orderBy, take, unescape } from 'lodash'; @@ -9,7 +10,7 @@ import { ContextMenu, ContextMenuTrigger, MenuItem } from 'react-contextmenu'; import { Manager, Popper, Reference } from 'react-popper'; import type { PreventOverflowModifier } from '@popperjs/core/lib/modifiers/preventOverflow'; -import { +import type { ConversationType, ConversationTypeType, InteractionModeType, @@ -23,22 +24,21 @@ import { ImageGrid } from './ImageGrid'; import { GIF } from './GIF'; import { Image } from './Image'; import { ContactName } from './ContactName'; -import { Quote, QuotedAttachmentType } from './Quote'; +import type { QuotedAttachmentType } from './Quote'; +import { Quote } from './Quote'; import { EmbeddedContact } from './EmbeddedContact'; -import { - OwnProps as ReactionViewerProps, - ReactionViewer, -} from './ReactionViewer'; -import { Props as ReactionPickerProps } from './ReactionPicker'; +import type { OwnProps as ReactionViewerProps } from './ReactionViewer'; +import { ReactionViewer } from './ReactionViewer'; +import type { Props as ReactionPickerProps } from './ReactionPicker'; import { Emoji } from '../emoji/Emoji'; import { LinkPreviewDate } from './LinkPreviewDate'; -import { LinkPreviewType } from '../../types/message/LinkPreviews'; +import type { LinkPreviewType } from '../../types/message/LinkPreviews'; import { shouldUseFullSizeLinkPreviewImage } from '../../linkPreviews/shouldUseFullSizeLinkPreviewImage'; import { WidthBreakpoint } from '../_util'; import * as log from '../../logging/log'; +import type { AttachmentType } from '../../types/Attachment'; import { - AttachmentType, canDisplayImage, getExtensionForDisplay, getGridDimensions, @@ -52,13 +52,17 @@ import { isVideo, isGIF, } from '../../types/Attachment'; -import { EmbeddedContactType } from '../../types/EmbeddedContact'; +import type { EmbeddedContactType } from '../../types/EmbeddedContact'; import { getIncrement } from '../../util/timer'; import { isFileDangerous } from '../../util/isFileDangerous'; import { missingCaseError } from '../../util/missingCaseError'; -import { BodyRangesType, LocalizerType, ThemeType } from '../../types/Util'; -import { +import type { + BodyRangesType, + LocalizerType, + ThemeType, +} from '../../types/Util'; +import type { ContactNameColorType, ConversationColorType, CustomColorType, diff --git a/ts/components/conversation/MessageAudio.tsx b/ts/components/conversation/MessageAudio.tsx index 62dbaab67..7a99b909c 100644 --- a/ts/components/conversation/MessageAudio.tsx +++ b/ts/components/conversation/MessageAudio.tsx @@ -6,11 +6,12 @@ import classNames from 'classnames'; import { noop } from 'lodash'; import { assert } from '../../util/assert'; -import { LocalizerType } from '../../types/Util'; -import { hasNotDownloaded, AttachmentType } from '../../types/Attachment'; +import type { LocalizerType } from '../../types/Util'; +import type { AttachmentType } from '../../types/Attachment'; +import { hasNotDownloaded } from '../../types/Attachment'; import type { DirectionType, MessageStatusType } from './Message'; -import { ComputePeaksResult } from '../GlobalAudioContext'; +import type { ComputePeaksResult } from '../GlobalAudioContext'; import { MessageMetadata } from './MessageMetadata'; import * as log from '../../logging/log'; diff --git a/ts/components/conversation/MessageBody.stories.tsx b/ts/components/conversation/MessageBody.stories.tsx index 329a29b67..88d234a3a 100644 --- a/ts/components/conversation/MessageBody.stories.tsx +++ b/ts/components/conversation/MessageBody.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { boolean, text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { MessageBody, Props } from './MessageBody'; +import type { Props } from './MessageBody'; +import { MessageBody } from './MessageBody'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/MessageBody.tsx b/ts/components/conversation/MessageBody.tsx index db24ba65e..f6829f2df 100644 --- a/ts/components/conversation/MessageBody.tsx +++ b/ts/components/conversation/MessageBody.tsx @@ -1,15 +1,17 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { KeyboardEvent } from 'react'; +import type { KeyboardEvent } from 'react'; +import React from 'react'; -import { getSizeClass, SizeClassType } from '../emoji/lib'; +import type { SizeClassType } from '../emoji/lib'; +import { getSizeClass } from '../emoji/lib'; import { AtMentionify } from './AtMentionify'; import { Emojify } from './Emojify'; import { AddNewLines } from './AddNewLines'; import { Linkify } from './Linkify'; -import { +import type { BodyRangesType, LocalizerType, RenderTextCallbackType, diff --git a/ts/components/conversation/MessageBodyReadMore.stories.tsx b/ts/components/conversation/MessageBodyReadMore.stories.tsx index c378ea7ba..c4fd6d3f9 100644 --- a/ts/components/conversation/MessageBodyReadMore.stories.tsx +++ b/ts/components/conversation/MessageBodyReadMore.stories.tsx @@ -7,7 +7,8 @@ import { action } from '@storybook/addon-actions'; import { text } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { MessageBodyReadMore, Props } from './MessageBodyReadMore'; +import type { Props } from './MessageBodyReadMore'; +import { MessageBodyReadMore } from './MessageBodyReadMore'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/MessageBodyReadMore.tsx b/ts/components/conversation/MessageBodyReadMore.tsx index e6e7fa992..5a58bfe34 100644 --- a/ts/components/conversation/MessageBodyReadMore.tsx +++ b/ts/components/conversation/MessageBodyReadMore.tsx @@ -3,7 +3,8 @@ import React, { useState } from 'react'; -import { MessageBody, Props as MessageBodyPropsType } from './MessageBody'; +import type { Props as MessageBodyPropsType } from './MessageBody'; +import { MessageBody } from './MessageBody'; export type Props = Pick< MessageBodyPropsType, diff --git a/ts/components/conversation/MessageDetail.stories.tsx b/ts/components/conversation/MessageDetail.stories.tsx index 9db441c29..8463400a0 100644 --- a/ts/components/conversation/MessageDetail.stories.tsx +++ b/ts/components/conversation/MessageDetail.stories.tsx @@ -7,8 +7,9 @@ import { action } from '@storybook/addon-actions'; import { number } from '@storybook/addon-knobs'; import { storiesOf } from '@storybook/react'; -import { PropsData as MessageDataPropsType } from './Message'; -import { MessageDetail, Props } from './MessageDetail'; +import type { PropsData as MessageDataPropsType } from './Message'; +import type { Props } from './MessageDetail'; +import { MessageDetail } from './MessageDetail'; import { SendStatus } from '../../messages/MessageSendState'; import { ReadStatus } from '../../messages/MessageReadStatus'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/conversation/MessageDetail.tsx b/ts/components/conversation/MessageDetail.tsx index 1616b150b..65eab5e79 100644 --- a/ts/components/conversation/MessageDetail.tsx +++ b/ts/components/conversation/MessageDetail.tsx @@ -1,22 +1,23 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild, ReactNode } from 'react'; +import type { ReactChild, ReactNode } from 'react'; +import React from 'react'; import classNames from 'classnames'; import moment from 'moment'; import { noop } from 'lodash'; import { Avatar, AvatarSize } from '../Avatar'; import { ContactName } from './ContactName'; -import { - Message, +import type { Props as MessagePropsType, PropsData as MessagePropsDataType, } from './Message'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import { Message } from './Message'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; import { groupBy } from '../../util/mapUtil'; -import { ContactNameColorType } from '../../types/Colors'; +import type { ContactNameColorType } from '../../types/Colors'; import { SendStatus } from '../../messages/MessageSendState'; import { WidthBreakpoint } from '../_util'; import * as log from '../../logging/log'; diff --git a/ts/components/conversation/MessageMetadata.tsx b/ts/components/conversation/MessageMetadata.tsx index ff4de6cf2..4563a155f 100644 --- a/ts/components/conversation/MessageMetadata.tsx +++ b/ts/components/conversation/MessageMetadata.tsx @@ -1,10 +1,11 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactChild } from 'react'; +import type { FunctionComponent, ReactChild } from 'react'; +import React from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import type { DirectionType, MessageStatusType } from './Message'; import { ExpireTimer } from './ExpireTimer'; import { Timestamp } from './Timestamp'; diff --git a/ts/components/conversation/MessageRequestActions.stories.tsx b/ts/components/conversation/MessageRequestActions.stories.tsx index e5f844993..707562bbd 100644 --- a/ts/components/conversation/MessageRequestActions.stories.tsx +++ b/ts/components/conversation/MessageRequestActions.stories.tsx @@ -6,10 +6,8 @@ import { storiesOf } from '@storybook/react'; import { text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { - MessageRequestActions, - Props as MessageRequestActionsProps, -} from './MessageRequestActions'; +import type { Props as MessageRequestActionsProps } from './MessageRequestActions'; +import { MessageRequestActions } from './MessageRequestActions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/MessageRequestActions.tsx b/ts/components/conversation/MessageRequestActions.tsx index a9963e98c..031a5d2ea 100644 --- a/ts/components/conversation/MessageRequestActions.tsx +++ b/ts/components/conversation/MessageRequestActions.tsx @@ -2,15 +2,16 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { ContactName, PropsType as ContactNameProps } from './ContactName'; +import type { PropsType as ContactNameProps } from './ContactName'; +import { ContactName } from './ContactName'; import { Button, ButtonVariant } from '../Button'; +import type { Props as MessageRequestActionsConfirmationProps } from './MessageRequestActionsConfirmation'; import { MessageRequestActionsConfirmation, MessageRequestState, - Props as MessageRequestActionsConfirmationProps, } from './MessageRequestActionsConfirmation'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type Props = { i18n: LocalizerType; diff --git a/ts/components/conversation/MessageRequestActionsConfirmation.tsx b/ts/components/conversation/MessageRequestActionsConfirmation.tsx index e0104779e..c608407ab 100644 --- a/ts/components/conversation/MessageRequestActionsConfirmation.tsx +++ b/ts/components/conversation/MessageRequestActionsConfirmation.tsx @@ -2,10 +2,11 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as React from 'react'; -import { ContactName, PropsType as ContactNameProps } from './ContactName'; +import type { PropsType as ContactNameProps } from './ContactName'; +import { ContactName } from './ContactName'; import { ConfirmationDialog } from '../ConfirmationDialog'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export enum MessageRequestState { blocking, diff --git a/ts/components/conversation/ProfileChangeNotification.tsx b/ts/components/conversation/ProfileChangeNotification.tsx index 9f0ef8ddf..9bef08d82 100644 --- a/ts/components/conversation/ProfileChangeNotification.tsx +++ b/ts/components/conversation/ProfileChangeNotification.tsx @@ -3,14 +3,12 @@ import React from 'react'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; import { SystemMessage } from './SystemMessage'; import { Emojify } from './Emojify'; -import { - getStringForProfileChange, - ProfileNameChangeType, -} from '../../util/getStringForProfileChange'; +import type { ProfileNameChangeType } from '../../util/getStringForProfileChange'; +import { getStringForProfileChange } from '../../util/getStringForProfileChange'; export type PropsType = { change: ProfileNameChangeType; diff --git a/ts/components/conversation/Quote.stories.tsx b/ts/components/conversation/Quote.stories.tsx index dcd7db03d..302f01347 100644 --- a/ts/components/conversation/Quote.stories.tsx +++ b/ts/components/conversation/Quote.stories.tsx @@ -10,7 +10,8 @@ import { storiesOf } from '@storybook/react'; import { ConversationColors } from '../../types/Colors'; import { pngUrl } from '../../storybook/Fixtures'; -import { Message, Props as MessagesProps } from './Message'; +import type { Props as MessagesProps } from './Message'; +import { Message } from './Message'; import { AUDIO_MP3, IMAGE_PNG, @@ -18,7 +19,8 @@ import { VIDEO_MP4, stringToMIMEType, } from '../../types/MIME'; -import { Props, Quote } from './Quote'; +import type { Props } from './Quote'; +import { Quote } from './Quote'; import { ReadStatus } from '../../messages/MessageReadStatus'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; diff --git a/ts/components/conversation/Quote.tsx b/ts/components/conversation/Quote.tsx index 6d551aa7a..a622d6ea2 100644 --- a/ts/components/conversation/Quote.tsx +++ b/ts/components/conversation/Quote.tsx @@ -1,7 +1,8 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useRef, useState, useEffect, ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React, { useRef, useState, useEffect } from 'react'; import { noop } from 'lodash'; import classNames from 'classnames'; @@ -9,8 +10,11 @@ import * as MIME from '../../types/MIME'; import * as GoogleChrome from '../../util/GoogleChrome'; import { MessageBody } from './MessageBody'; -import { BodyRangesType, LocalizerType } from '../../types/Util'; -import { ConversationColorType, CustomColorType } from '../../types/Colors'; +import type { BodyRangesType, LocalizerType } from '../../types/Util'; +import type { + ConversationColorType, + CustomColorType, +} from '../../types/Colors'; import { ContactName } from './ContactName'; import { getTextWithMentions } from '../../util/getTextWithMentions'; import { getCustomColorStyle } from '../../util/getCustomColorStyle'; diff --git a/ts/components/conversation/ReactionPicker.stories.tsx b/ts/components/conversation/ReactionPicker.stories.tsx index a06aedb0b..ba0f92b32 100644 --- a/ts/components/conversation/ReactionPicker.stories.tsx +++ b/ts/components/conversation/ReactionPicker.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props as ReactionPickerProps, ReactionPicker } from './ReactionPicker'; +import type { Props as ReactionPickerProps } from './ReactionPicker'; +import { ReactionPicker } from './ReactionPicker'; import { EmojiPicker } from '../emoji/EmojiPicker'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/ReactionPicker.tsx b/ts/components/conversation/ReactionPicker.tsx index 9a23d35a1..0427725d4 100644 --- a/ts/components/conversation/ReactionPicker.tsx +++ b/ts/components/conversation/ReactionPicker.tsx @@ -3,9 +3,9 @@ import * as React from 'react'; import { convertShortName } from '../emoji/lib'; -import { Props as EmojiPickerProps } from '../emoji/EmojiPicker'; +import type { Props as EmojiPickerProps } from '../emoji/EmojiPicker'; import { useRestoreFocus } from '../../hooks/useRestoreFocus'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { ReactionPickerPicker, ReactionPickerPickerEmojiButton, diff --git a/ts/components/conversation/ReactionViewer.stories.tsx b/ts/components/conversation/ReactionViewer.stories.tsx index 3109d8528..a29019c35 100644 --- a/ts/components/conversation/ReactionViewer.stories.tsx +++ b/ts/components/conversation/ReactionViewer.stories.tsx @@ -6,7 +6,8 @@ import * as React from 'react'; import { action } from '@storybook/addon-actions'; import { storiesOf } from '@storybook/react'; -import { Props, ReactionViewer } from './ReactionViewer'; +import type { Props } from './ReactionViewer'; +import { ReactionViewer } from './ReactionViewer'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; diff --git a/ts/components/conversation/ReactionViewer.tsx b/ts/components/conversation/ReactionViewer.tsx index 69eb2fbb4..477a9fdf9 100644 --- a/ts/components/conversation/ReactionViewer.tsx +++ b/ts/components/conversation/ReactionViewer.tsx @@ -5,11 +5,13 @@ import * as React from 'react'; import { groupBy, mapValues, orderBy } from 'lodash'; import classNames from 'classnames'; import { ContactName } from './ContactName'; -import { Avatar, Props as AvatarProps } from '../Avatar'; +import type { Props as AvatarProps } from '../Avatar'; +import { Avatar } from '../Avatar'; import { Emoji } from '../emoji/Emoji'; import { useRestoreFocus } from '../../hooks/useRestoreFocus'; -import { ConversationType } from '../../state/ducks/conversations'; -import { emojiToData, EmojiData } from '../emoji/lib'; +import type { ConversationType } from '../../state/ducks/conversations'; +import type { EmojiData } from '../emoji/lib'; +import { emojiToData } from '../emoji/lib'; import { useEscapeHandling } from '../../hooks/useEscapeHandling'; export type Reaction = { diff --git a/ts/components/conversation/RemoveGroupMemberConfirmationDialog.tsx b/ts/components/conversation/RemoveGroupMemberConfirmationDialog.tsx index 83ba5c7cb..07a171f07 100644 --- a/ts/components/conversation/RemoveGroupMemberConfirmationDialog.tsx +++ b/ts/components/conversation/RemoveGroupMemberConfirmationDialog.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; -import { ConversationType } from '../../state/ducks/conversations'; -import { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; import { ConfirmationDialog } from '../ConfirmationDialog'; import { Intl } from '../Intl'; diff --git a/ts/components/conversation/ResetSessionNotification.tsx b/ts/components/conversation/ResetSessionNotification.tsx index e2358e4f5..164813a3a 100644 --- a/ts/components/conversation/ResetSessionNotification.tsx +++ b/ts/components/conversation/ResetSessionNotification.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { SystemMessage } from './SystemMessage'; export type Props = { diff --git a/ts/components/conversation/SafetyNumberNotification.stories.tsx b/ts/components/conversation/SafetyNumberNotification.stories.tsx index a3a802191..422d0d3fa 100644 --- a/ts/components/conversation/SafetyNumberNotification.stories.tsx +++ b/ts/components/conversation/SafetyNumberNotification.stories.tsx @@ -8,11 +8,8 @@ import { boolean, text } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { - ContactType, - Props, - SafetyNumberNotification, -} from './SafetyNumberNotification'; +import type { ContactType, Props } from './SafetyNumberNotification'; +import { SafetyNumberNotification } from './SafetyNumberNotification'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/SafetyNumberNotification.tsx b/ts/components/conversation/SafetyNumberNotification.tsx index a8f17c50d..328482a41 100644 --- a/ts/components/conversation/SafetyNumberNotification.tsx +++ b/ts/components/conversation/SafetyNumberNotification.tsx @@ -7,7 +7,7 @@ import { Button, ButtonSize, ButtonVariant } from '../Button'; import { SystemMessage } from './SystemMessage'; import { ContactName } from './ContactName'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type ContactType = { id: string; diff --git a/ts/components/conversation/ScrollDownButton.stories.tsx b/ts/components/conversation/ScrollDownButton.stories.tsx index c26a5b17f..b53e56ded 100644 --- a/ts/components/conversation/ScrollDownButton.stories.tsx +++ b/ts/components/conversation/ScrollDownButton.stories.tsx @@ -8,7 +8,8 @@ import { boolean } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, ScrollDownButton } from './ScrollDownButton'; +import type { Props } from './ScrollDownButton'; +import { ScrollDownButton } from './ScrollDownButton'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/ScrollDownButton.tsx b/ts/components/conversation/ScrollDownButton.tsx index bdc0859ed..b50d8aecb 100644 --- a/ts/components/conversation/ScrollDownButton.tsx +++ b/ts/components/conversation/ScrollDownButton.tsx @@ -4,7 +4,7 @@ import React from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type Props = { withNewMessages: boolean; diff --git a/ts/components/conversation/StagedGenericAttachment.stories.tsx b/ts/components/conversation/StagedGenericAttachment.stories.tsx index 9cc7d11f0..8fc7ff639 100644 --- a/ts/components/conversation/StagedGenericAttachment.stories.tsx +++ b/ts/components/conversation/StagedGenericAttachment.stories.tsx @@ -6,11 +6,12 @@ import { storiesOf } from '@storybook/react'; import { text } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { AttachmentType } from '../../types/Attachment'; +import type { AttachmentType } from '../../types/Attachment'; import { stringToMIMEType } from '../../types/MIME'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, StagedGenericAttachment } from './StagedGenericAttachment'; +import type { Props } from './StagedGenericAttachment'; +import { StagedGenericAttachment } from './StagedGenericAttachment'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/StagedGenericAttachment.tsx b/ts/components/conversation/StagedGenericAttachment.tsx index b597697e2..d623c7a8f 100644 --- a/ts/components/conversation/StagedGenericAttachment.tsx +++ b/ts/components/conversation/StagedGenericAttachment.tsx @@ -3,8 +3,9 @@ import React from 'react'; -import { AttachmentType, getExtensionForDisplay } from '../../types/Attachment'; -import { LocalizerType } from '../../types/Util'; +import type { AttachmentType } from '../../types/Attachment'; +import { getExtensionForDisplay } from '../../types/Attachment'; +import type { LocalizerType } from '../../types/Util'; export type Props = { attachment: AttachmentType; diff --git a/ts/components/conversation/StagedLinkPreview.stories.tsx b/ts/components/conversation/StagedLinkPreview.stories.tsx index 575b0986a..24dcda2a4 100644 --- a/ts/components/conversation/StagedLinkPreview.stories.tsx +++ b/ts/components/conversation/StagedLinkPreview.stories.tsx @@ -6,11 +6,12 @@ import { storiesOf } from '@storybook/react'; import { date, text, withKnobs } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { AttachmentType } from '../../types/Attachment'; +import type { AttachmentType } from '../../types/Attachment'; import { stringToMIMEType } from '../../types/MIME'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, StagedLinkPreview } from './StagedLinkPreview'; +import type { Props } from './StagedLinkPreview'; +import { StagedLinkPreview } from './StagedLinkPreview'; const LONG_TITLE = "This is a super-sweet site. And it's got some really amazing content in store for you if you just click that link. Can you click that link for me?"; diff --git a/ts/components/conversation/StagedLinkPreview.tsx b/ts/components/conversation/StagedLinkPreview.tsx index 815df29fe..a84bbc8fc 100644 --- a/ts/components/conversation/StagedLinkPreview.tsx +++ b/ts/components/conversation/StagedLinkPreview.tsx @@ -7,8 +7,9 @@ import classNames from 'classnames'; import { Image } from './Image'; import { LinkPreviewDate } from './LinkPreviewDate'; -import { AttachmentType, isImageAttachment } from '../../types/Attachment'; -import { LocalizerType } from '../../types/Util'; +import type { AttachmentType } from '../../types/Attachment'; +import { isImageAttachment } from '../../types/Attachment'; +import type { LocalizerType } from '../../types/Util'; export type Props = { title?: string; diff --git a/ts/components/conversation/StagedPlaceholderAttachment.tsx b/ts/components/conversation/StagedPlaceholderAttachment.tsx index 911929af7..fe9006817 100644 --- a/ts/components/conversation/StagedPlaceholderAttachment.tsx +++ b/ts/components/conversation/StagedPlaceholderAttachment.tsx @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React from 'react'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; type Props = { onClick: () => void; diff --git a/ts/components/conversation/SystemMessage.tsx b/ts/components/conversation/SystemMessage.tsx index ffed77603..847407fd9 100644 --- a/ts/components/conversation/SystemMessage.tsx +++ b/ts/components/conversation/SystemMessage.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode, forwardRef } from 'react'; +import type { ReactNode } from 'react'; +import React, { forwardRef } from 'react'; import classNames from 'classnames'; type PropsType = { diff --git a/ts/components/conversation/SystemTraySettingsCheckboxes.tsx b/ts/components/conversation/SystemTraySettingsCheckboxes.tsx index 1c7660f90..aa92ce1b3 100644 --- a/ts/components/conversation/SystemTraySettingsCheckboxes.tsx +++ b/ts/components/conversation/SystemTraySettingsCheckboxes.tsx @@ -1,13 +1,14 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ChangeEvent, FunctionComponent, useState } from 'react'; +import type { ChangeEvent, FunctionComponent } from 'react'; +import React, { useState } from 'react'; import { SystemTraySetting, parseSystemTraySetting, shouldMinimizeToSystemTray, } from '../../types/SystemTraySetting'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; type PropsType = { i18n: LocalizerType; diff --git a/ts/components/conversation/Timeline.stories.tsx b/ts/components/conversation/Timeline.stories.tsx index 08a02bbc2..f6af794a7 100644 --- a/ts/components/conversation/Timeline.stories.tsx +++ b/ts/components/conversation/Timeline.stories.tsx @@ -11,8 +11,10 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { PropsType, Timeline } from './Timeline'; -import { TimelineItem, TimelineItemType } from './TimelineItem'; +import type { PropsType } from './Timeline'; +import { Timeline } from './Timeline'; +import type { TimelineItemType } from './TimelineItem'; +import { TimelineItem } from './TimelineItem'; import { ConversationHero } from './ConversationHero'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; import { getRandomColor } from '../../test-both/helpers/getRandomColor'; @@ -21,7 +23,7 @@ import { TimelineLoadingRow } from './TimelineLoadingRow'; import { TypingBubble } from './TypingBubble'; import { ContactSpoofingType } from '../../util/contactSpoofing'; import { ReadStatus } from '../../messages/MessageReadStatus'; -import { WidthBreakpoint } from '../_util'; +import type { WidthBreakpoint } from '../_util'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/Timeline.tsx b/ts/components/conversation/Timeline.tsx index d480c702b..6e13b3db5 100644 --- a/ts/components/conversation/Timeline.tsx +++ b/ts/components/conversation/Timeline.tsx @@ -3,41 +3,40 @@ import { debounce, get, isNumber, pick, identity } from 'lodash'; import classNames from 'classnames'; -import React, { CSSProperties, ReactChild, ReactNode, RefObject } from 'react'; +import type { CSSProperties, ReactChild, ReactNode, RefObject } from 'react'; +import React from 'react'; import { createSelector } from 'reselect'; +import type { Grid } from 'react-virtualized'; import { AutoSizer, CellMeasurer, CellMeasurerCache, List, - Grid, } from 'react-virtualized'; import Measure from 'react-measure'; import { ScrollDownButton } from './ScrollDownButton'; -import { AssertProps, LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { AssertProps, LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; import { assert } from '../../util/assert'; import { missingCaseError } from '../../util/missingCaseError'; import { createRefMerger } from '../../util/refMerger'; import { WidthBreakpoint } from '../_util'; -import { PropsActions as MessageActionsType } from './Message'; -import { PropsActions as UnsupportedMessageActionsType } from './UnsupportedMessage'; -import { PropsActionsType as ChatSessionRefreshedNotificationActionsType } from './ChatSessionRefreshedNotification'; +import type { PropsActions as MessageActionsType } from './Message'; +import type { PropsActions as UnsupportedMessageActionsType } from './UnsupportedMessage'; +import type { PropsActionsType as ChatSessionRefreshedNotificationActionsType } from './ChatSessionRefreshedNotification'; import { ErrorBoundary } from './ErrorBoundary'; -import { PropsActions as SafetyNumberActionsType } from './SafetyNumberNotification'; +import type { PropsActions as SafetyNumberActionsType } from './SafetyNumberNotification'; import { Intl } from '../Intl'; import { TimelineWarning } from './TimelineWarning'; import { TimelineWarnings } from './TimelineWarnings'; import { NewlyCreatedGroupInvitedContactsDialog } from '../NewlyCreatedGroupInvitedContactsDialog'; import { ContactSpoofingType } from '../../util/contactSpoofing'; import { ContactSpoofingReviewDialog } from './ContactSpoofingReviewDialog'; -import { - GroupNameCollisionsWithIdsByTitle, - hasUnacknowledgedCollisions, -} from '../../util/groupMemberNameCollisions'; +import type { GroupNameCollisionsWithIdsByTitle } from '../../util/groupMemberNameCollisions'; +import { hasUnacknowledgedCollisions } from '../../util/groupMemberNameCollisions'; const AT_BOTTOM_THRESHOLD = 15; const NEAR_BOTTOM_THRESHOLD = 15; diff --git a/ts/components/conversation/TimelineItem.stories.tsx b/ts/components/conversation/TimelineItem.stories.tsx index 0db305e38..1624a774e 100644 --- a/ts/components/conversation/TimelineItem.stories.tsx +++ b/ts/components/conversation/TimelineItem.stories.tsx @@ -9,7 +9,8 @@ import { action } from '@storybook/addon-actions'; import { EmojiPicker } from '../emoji/EmojiPicker'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { PropsType as TimelineItemProps, TimelineItem } from './TimelineItem'; +import type { PropsType as TimelineItemProps } from './TimelineItem'; +import { TimelineItem } from './TimelineItem'; import { UniversalTimerNotification } from './UniversalTimerNotification'; import { CallMode } from '../../types/Calling'; import { AvatarColors } from '../../types/Colors'; diff --git a/ts/components/conversation/TimelineItem.tsx b/ts/components/conversation/TimelineItem.tsx index c052eaf1a..876c18210 100644 --- a/ts/components/conversation/TimelineItem.tsx +++ b/ts/components/conversation/TimelineItem.tsx @@ -1,74 +1,57 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { RefObject } from 'react'; +import type { RefObject } from 'react'; +import React from 'react'; import { omit } from 'lodash'; -import { LocalizerType, ThemeType } from '../../types/Util'; +import type { LocalizerType, ThemeType } from '../../types/Util'; -import { InteractionModeType } from '../../state/ducks/conversations'; -import { - Message, +import type { InteractionModeType } from '../../state/ducks/conversations'; +import type { Props as AllMessageProps, PropsActions as MessageActionsType, PropsData as MessageProps, } from './Message'; -import { - CallingNotification, - PropsActionsType as CallingNotificationActionsType, -} from './CallingNotification'; -import { - ChatSessionRefreshedNotification, - PropsActionsType as PropsChatSessionRefreshedActionsType, -} from './ChatSessionRefreshedNotification'; -import { - DeliveryIssueNotification, +import { Message } from './Message'; +import type { PropsActionsType as CallingNotificationActionsType } from './CallingNotification'; +import { CallingNotification } from './CallingNotification'; +import type { PropsActionsType as PropsChatSessionRefreshedActionsType } from './ChatSessionRefreshedNotification'; +import { ChatSessionRefreshedNotification } from './ChatSessionRefreshedNotification'; +import type { PropsActionsType as DeliveryIssueActionProps, PropsDataType as DeliveryIssueProps, } from './DeliveryIssueNotification'; +import { DeliveryIssueNotification } from './DeliveryIssueNotification'; import { LinkNotification } from './LinkNotification'; -import { - ChangeNumberNotification, - PropsData as ChangeNumberNotificationProps, -} from './ChangeNumberNotification'; -import { CallingNotificationType } from '../../util/callingNotification'; +import type { PropsData as ChangeNumberNotificationProps } from './ChangeNumberNotification'; +import { ChangeNumberNotification } from './ChangeNumberNotification'; +import type { CallingNotificationType } from '../../util/callingNotification'; import { InlineNotificationWrapper } from './InlineNotificationWrapper'; -import { +import type { PropsActions as UnsupportedMessageActionsType, PropsData as UnsupportedMessageProps, - UnsupportedMessage, } from './UnsupportedMessage'; -import { - PropsData as TimerNotificationProps, - TimerNotification, -} from './TimerNotification'; -import { +import { UnsupportedMessage } from './UnsupportedMessage'; +import type { PropsData as TimerNotificationProps } from './TimerNotification'; +import { TimerNotification } from './TimerNotification'; +import type { PropsActions as SafetyNumberActionsType, PropsData as SafetyNumberNotificationProps, - SafetyNumberNotification, } from './SafetyNumberNotification'; -import { - PropsData as VerificationNotificationProps, - VerificationNotification, -} from './VerificationNotification'; -import { - GroupNotification, - PropsData as GroupNotificationProps, -} from './GroupNotification'; -import { - GroupV2Change, - PropsDataType as GroupV2ChangeProps, -} from './GroupV2Change'; -import { - GroupV1Migration, - PropsDataType as GroupV1MigrationProps, -} from './GroupV1Migration'; -import { SmartContactRendererType } from '../../groupChange'; +import { SafetyNumberNotification } from './SafetyNumberNotification'; +import type { PropsData as VerificationNotificationProps } from './VerificationNotification'; +import { VerificationNotification } from './VerificationNotification'; +import type { PropsData as GroupNotificationProps } from './GroupNotification'; +import { GroupNotification } from './GroupNotification'; +import type { PropsDataType as GroupV2ChangeProps } from './GroupV2Change'; +import { GroupV2Change } from './GroupV2Change'; +import type { PropsDataType as GroupV1MigrationProps } from './GroupV1Migration'; +import { GroupV1Migration } from './GroupV1Migration'; +import type { SmartContactRendererType } from '../../groupChange'; import { ResetSessionNotification } from './ResetSessionNotification'; -import { - ProfileChangeNotification, - PropsType as ProfileChangeNotificationPropsType, -} from './ProfileChangeNotification'; +import type { PropsType as ProfileChangeNotificationPropsType } from './ProfileChangeNotification'; +import { ProfileChangeNotification } from './ProfileChangeNotification'; import * as log from '../../logging/log'; type CallHistoryType = { diff --git a/ts/components/conversation/TimelineLoadingRow.stories.tsx b/ts/components/conversation/TimelineLoadingRow.stories.tsx index f159d40dd..0c2c9c5bc 100644 --- a/ts/components/conversation/TimelineLoadingRow.stories.tsx +++ b/ts/components/conversation/TimelineLoadingRow.stories.tsx @@ -6,7 +6,8 @@ import { storiesOf } from '@storybook/react'; import { date, number, select } from '@storybook/addon-knobs'; import { action } from '@storybook/addon-actions'; -import { Props, TimelineLoadingRow } from './TimelineLoadingRow'; +import type { Props } from './TimelineLoadingRow'; +import { TimelineLoadingRow } from './TimelineLoadingRow'; const story = storiesOf('Components/Conversation/TimelineLoadingRow', module); diff --git a/ts/components/conversation/TimelineWarning.tsx b/ts/components/conversation/TimelineWarning.tsx index 5cd7c1f6d..e544d26d2 100644 --- a/ts/components/conversation/TimelineWarning.tsx +++ b/ts/components/conversation/TimelineWarning.tsx @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; const CLASS_NAME = 'module-TimelineWarning'; const ICON_CONTAINER_CLASS_NAME = `${CLASS_NAME}__icon-container`; diff --git a/ts/components/conversation/TimelineWarnings.tsx b/ts/components/conversation/TimelineWarnings.tsx index 5f027553a..96fb90ccb 100644 --- a/ts/components/conversation/TimelineWarnings.tsx +++ b/ts/components/conversation/TimelineWarnings.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { forwardRef, ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React, { forwardRef } from 'react'; const CLASS_NAME = 'module-TimelineWarnings'; diff --git a/ts/components/conversation/TimerNotification.stories.tsx b/ts/components/conversation/TimerNotification.stories.tsx index ec64e8a26..205400cee 100644 --- a/ts/components/conversation/TimerNotification.stories.tsx +++ b/ts/components/conversation/TimerNotification.stories.tsx @@ -8,7 +8,8 @@ import { boolean, number, select, text } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, TimerNotification } from './TimerNotification'; +import type { Props } from './TimerNotification'; +import { TimerNotification } from './TimerNotification'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/TimerNotification.tsx b/ts/components/conversation/TimerNotification.tsx index 807844808..7ee484391 100644 --- a/ts/components/conversation/TimerNotification.tsx +++ b/ts/components/conversation/TimerNotification.tsx @@ -1,12 +1,13 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React from 'react'; import { ContactName } from './ContactName'; import { SystemMessage } from './SystemMessage'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import * as expirationTimer from '../../util/expirationTimer'; import * as log from '../../logging/log'; diff --git a/ts/components/conversation/Timestamp.stories.tsx b/ts/components/conversation/Timestamp.stories.tsx index 147174464..43396afa4 100644 --- a/ts/components/conversation/Timestamp.stories.tsx +++ b/ts/components/conversation/Timestamp.stories.tsx @@ -7,7 +7,8 @@ import { boolean, date, select, text } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, Timestamp } from './Timestamp'; +import type { Props } from './Timestamp'; +import { Timestamp } from './Timestamp'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/Timestamp.tsx b/ts/components/conversation/Timestamp.tsx index 7c4389f15..de7445c9f 100644 --- a/ts/components/conversation/Timestamp.tsx +++ b/ts/components/conversation/Timestamp.tsx @@ -7,7 +7,7 @@ import moment from 'moment'; import { formatRelativeTime } from '../../util/formatRelativeTime'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type Props = { timestamp?: number; diff --git a/ts/components/conversation/TypingAnimation.stories.tsx b/ts/components/conversation/TypingAnimation.stories.tsx index 2ed7ea76c..a6f85c156 100644 --- a/ts/components/conversation/TypingAnimation.stories.tsx +++ b/ts/components/conversation/TypingAnimation.stories.tsx @@ -6,7 +6,8 @@ import { storiesOf } from '@storybook/react'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, TypingAnimation } from './TypingAnimation'; +import type { Props } from './TypingAnimation'; +import { TypingAnimation } from './TypingAnimation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/TypingAnimation.tsx b/ts/components/conversation/TypingAnimation.tsx index 383cda6f4..0d776f296 100644 --- a/ts/components/conversation/TypingAnimation.tsx +++ b/ts/components/conversation/TypingAnimation.tsx @@ -4,7 +4,7 @@ import React from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type Props = { i18n: LocalizerType; diff --git a/ts/components/conversation/TypingBubble.stories.tsx b/ts/components/conversation/TypingBubble.stories.tsx index 8ba2e20a0..e89ec8fb5 100644 --- a/ts/components/conversation/TypingBubble.stories.tsx +++ b/ts/components/conversation/TypingBubble.stories.tsx @@ -7,7 +7,8 @@ import { select, text } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, TypingBubble } from './TypingBubble'; +import type { Props } from './TypingBubble'; +import { TypingBubble } from './TypingBubble'; import { AvatarColors } from '../../types/Colors'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/TypingBubble.tsx b/ts/components/conversation/TypingBubble.tsx index a7e1ac547..8f514f009 100644 --- a/ts/components/conversation/TypingBubble.tsx +++ b/ts/components/conversation/TypingBubble.tsx @@ -7,8 +7,8 @@ import classNames from 'classnames'; import { TypingAnimation } from './TypingAnimation'; import { Avatar } from '../Avatar'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; export type Props = Pick< ConversationType, diff --git a/ts/components/conversation/UniversalTimerNotification.tsx b/ts/components/conversation/UniversalTimerNotification.tsx index 97f3ae279..70e1e23bb 100644 --- a/ts/components/conversation/UniversalTimerNotification.tsx +++ b/ts/components/conversation/UniversalTimerNotification.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { SystemMessage } from './SystemMessage'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import * as expirationTimer from '../../util/expirationTimer'; export type Props = { diff --git a/ts/components/conversation/UnsupportedMessage.stories.tsx b/ts/components/conversation/UnsupportedMessage.stories.tsx index d7aaeef28..9678aad0d 100644 --- a/ts/components/conversation/UnsupportedMessage.stories.tsx +++ b/ts/components/conversation/UnsupportedMessage.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { ContactType, Props, UnsupportedMessage } from './UnsupportedMessage'; +import type { ContactType, Props } from './UnsupportedMessage'; +import { UnsupportedMessage } from './UnsupportedMessage'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/UnsupportedMessage.tsx b/ts/components/conversation/UnsupportedMessage.tsx index 754412699..1cfdb2a5a 100644 --- a/ts/components/conversation/UnsupportedMessage.tsx +++ b/ts/components/conversation/UnsupportedMessage.tsx @@ -7,7 +7,7 @@ import { SystemMessage } from './SystemMessage'; import { Button, ButtonSize, ButtonVariant } from '../Button'; import { ContactName } from './ContactName'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type ContactType = { id: string; diff --git a/ts/components/conversation/VerificationNotification.stories.tsx b/ts/components/conversation/VerificationNotification.stories.tsx index 5ba9f9f35..e2fb461e8 100644 --- a/ts/components/conversation/VerificationNotification.stories.tsx +++ b/ts/components/conversation/VerificationNotification.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, VerificationNotification } from './VerificationNotification'; +import type { Props } from './VerificationNotification'; +import { VerificationNotification } from './VerificationNotification'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/VerificationNotification.tsx b/ts/components/conversation/VerificationNotification.tsx index 2204183ec..aa3476af5 100644 --- a/ts/components/conversation/VerificationNotification.tsx +++ b/ts/components/conversation/VerificationNotification.tsx @@ -6,7 +6,7 @@ import React from 'react'; import { SystemMessage } from './SystemMessage'; import { ContactName } from './ContactName'; import { Intl } from '../Intl'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { missingCaseError } from '../../util/missingCaseError'; diff --git a/ts/components/conversation/_contactUtil.tsx b/ts/components/conversation/_contactUtil.tsx index 9074909e7..8af8a3e93 100644 --- a/ts/components/conversation/_contactUtil.tsx +++ b/ts/components/conversation/_contactUtil.tsx @@ -7,9 +7,10 @@ import classNames from 'classnames'; import { Avatar, AvatarBlur } from '../Avatar'; import { Spinner } from '../Spinner'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { AvatarColors } from '../../types/Colors'; -import { EmbeddedContactType, getName } from '../../types/EmbeddedContact'; +import type { EmbeddedContactType } from '../../types/EmbeddedContact'; +import { getName } from '../../types/EmbeddedContact'; // This file starts with _ to keep it from showing up in the StyleGuide. diff --git a/ts/components/conversation/conversation-details/AddGroupMembersModal.stories.tsx b/ts/components/conversation/conversation-details/AddGroupMembersModal.stories.tsx index 741b2e1f4..b3b396cb2 100644 --- a/ts/components/conversation/conversation-details/AddGroupMembersModal.stories.tsx +++ b/ts/components/conversation/conversation-details/AddGroupMembersModal.stories.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ComponentProps, useState } from 'react'; +import type { ComponentProps } from 'react'; +import React, { useState } from 'react'; import { times } from 'lodash'; import { storiesOf } from '@storybook/react'; diff --git a/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx b/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx index a190904f3..e4d9d9394 100644 --- a/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx +++ b/ts/components/conversation/conversation-details/AddGroupMembersModal.tsx @@ -1,15 +1,16 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, useMemo, useReducer } from 'react'; +import type { FunctionComponent } from 'react'; +import React, { useMemo, useReducer } from 'react'; import { without } from 'lodash'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; import { AddGroupMemberErrorDialog, AddGroupMemberErrorDialogMode, } from '../../AddGroupMemberErrorDialog'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { getGroupSizeRecommendedLimit, getGroupSizeHardLimit, @@ -21,7 +22,7 @@ import { import { makeLookup } from '../../../util/makeLookup'; import { deconstructLookup } from '../../../util/deconstructLookup'; import { missingCaseError } from '../../../util/missingCaseError'; -import { RequestState } from './util'; +import type { RequestState } from './util'; import { ChooseGroupMembersModal } from './AddGroupMembersModal/ChooseGroupMembersModal'; import { ConfirmAdditionsModal } from './AddGroupMembersModal/ConfirmAdditionsModal'; diff --git a/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx b/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx index 3f1deb30e..156950736 100644 --- a/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx +++ b/ts/components/conversation/conversation-details/AddGroupMembersModal/ChooseGroupMembersModal.tsx @@ -1,27 +1,24 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - FunctionComponent, - useEffect, - useMemo, - useState, - useRef, -} from 'react'; -import Measure, { MeasuredComponentProps } from 'react-measure'; +import type { FunctionComponent } from 'react'; +import React, { useEffect, useMemo, useState, useRef } from 'react'; +import type { MeasuredComponentProps } from 'react-measure'; +import Measure from 'react-measure'; -import { LocalizerType } from '../../../../types/Util'; +import type { LocalizerType } from '../../../../types/Util'; import { assert } from '../../../../util/assert'; import { getOwn } from '../../../../util/getOwn'; import { refMerger } from '../../../../util/refMerger'; import { useRestoreFocus } from '../../../../hooks/useRestoreFocus'; import { missingCaseError } from '../../../../util/missingCaseError'; import { filterAndSortConversationsByTitle } from '../../../../util/filterAndSortConversations'; -import { ConversationType } from '../../../../state/ducks/conversations'; +import type { ConversationType } from '../../../../state/ducks/conversations'; import { ModalHost } from '../../../ModalHost'; import { ContactPills } from '../../../ContactPills'; import { ContactPill } from '../../../ContactPill'; -import { ConversationList, Row, RowType } from '../../../ConversationList'; +import type { Row } from '../../../ConversationList'; +import { ConversationList, RowType } from '../../../ConversationList'; import { ContactCheckboxDisabledReason } from '../../../conversationList/ContactCheckbox'; import { Button, ButtonVariant } from '../../../Button'; import { SearchInput } from '../../../SearchInput'; diff --git a/ts/components/conversation/conversation-details/AddGroupMembersModal/ConfirmAdditionsModal.tsx b/ts/components/conversation/conversation-details/AddGroupMembersModal/ConfirmAdditionsModal.tsx index 2017a455a..fbb1e83f5 100644 --- a/ts/components/conversation/conversation-details/AddGroupMembersModal/ConfirmAdditionsModal.tsx +++ b/ts/components/conversation/conversation-details/AddGroupMembersModal/ConfirmAdditionsModal.tsx @@ -1,14 +1,15 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React from 'react'; -import { LocalizerType } from '../../../../types/Util'; +import type { LocalizerType } from '../../../../types/Util'; import { assert } from '../../../../util/assert'; import { ModalHost } from '../../../ModalHost'; import { Button, ButtonVariant } from '../../../Button'; import { Spinner } from '../../../Spinner'; -import { ConversationType } from '../../../../state/ducks/conversations'; +import type { ConversationType } from '../../../../state/ducks/conversations'; import { RequestState } from '../util'; import { Intl } from '../../../Intl'; import { Emojify } from '../../Emojify'; diff --git a/ts/components/conversation/conversation-details/ConversationDetails.stories.tsx b/ts/components/conversation/conversation-details/ConversationDetails.stories.tsx index aadbf5426..94c1a8bb9 100644 --- a/ts/components/conversation/conversation-details/ConversationDetails.stories.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetails.stories.tsx @@ -10,8 +10,9 @@ import { times } from 'lodash'; import { setupI18n } from '../../../util/setupI18n'; import { CapabilityError } from '../../../types/errors'; import enMessages from '../../../../_locales/en/messages.json'; -import { ConversationDetails, Props } from './ConversationDetails'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { Props } from './ConversationDetails'; +import { ConversationDetails } from './ConversationDetails'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/ConversationDetails.tsx b/ts/components/conversation/conversation-details/ConversationDetails.tsx index 1a4299427..e3e2b3661 100644 --- a/ts/components/conversation/conversation-details/ConversationDetails.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetails.tsx @@ -1,15 +1,16 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useState, ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React, { useState } from 'react'; import { Button, ButtonIconType, ButtonVariant } from '../../Button'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { assert } from '../../../util/assert'; import { getMutedUntilText } from '../../../util/getMutedUntilText'; -import { LocalizerType } from '../../../types/Util'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { LocalizerType } from '../../../types/Util'; +import type { MediaItemType } from '../../../types/MediaItem'; import { CapabilityError } from '../../../types/errors'; import { missingCaseError } from '../../../util/missingCaseError'; @@ -22,11 +23,9 @@ import { ConversationDetailsActions } from './ConversationDetailsActions'; import { ConversationDetailsHeader } from './ConversationDetailsHeader'; import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon'; import { ConversationDetailsMediaList } from './ConversationDetailsMediaList'; -import { - ConversationDetailsMembershipList, - GroupV2Membership, -} from './ConversationDetailsMembershipList'; -import { +import type { GroupV2Membership } from './ConversationDetailsMembershipList'; +import { ConversationDetailsMembershipList } from './ConversationDetailsMembershipList'; +import type { GroupV2PendingMembership, GroupV2RequestingMembership, } from './PendingInvites'; @@ -35,7 +34,7 @@ import { RequestState } from './util'; import { getCustomColorStyle } from '../../../util/getCustomColorStyle'; import { ConfirmationDialog } from '../../ConfirmationDialog'; import { ConversationNotificationsModal } from './ConversationNotificationsModal'; -import { +import type { AvatarDataType, DeleteAvatarFromDiskActionType, ReplaceAvatarActionType, diff --git a/ts/components/conversation/conversation-details/ConversationDetailsActions.stories.tsx b/ts/components/conversation/conversation-details/ConversationDetailsActions.stories.tsx index b080ea17f..37d0e9a25 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsActions.stories.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsActions.stories.tsx @@ -9,10 +9,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { - ConversationDetailsActions, - Props, -} from './ConversationDetailsActions'; +import type { Props } from './ConversationDetailsActions'; +import { ConversationDetailsActions } from './ConversationDetailsActions'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/ConversationDetailsActions.tsx b/ts/components/conversation/conversation-details/ConversationDetailsActions.tsx index 8c6bc1486..b13d5fdff 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsActions.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsActions.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode, useState } from 'react'; +import type { ReactNode } from 'react'; +import React, { useState } from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; import { ConfirmationDialog } from '../../ConfirmationDialog'; import { Tooltip, TooltipPlacement } from '../../Tooltip'; diff --git a/ts/components/conversation/conversation-details/ConversationDetailsHeader.stories.tsx b/ts/components/conversation/conversation-details/ConversationDetailsHeader.stories.tsx index 4a47bd39e..2a7c49b26 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsHeader.stories.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsHeader.stories.tsx @@ -10,9 +10,10 @@ import { number, text } from '@storybook/addon-knobs'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; -import { ConversationDetailsHeader, Props } from './ConversationDetailsHeader'; +import type { Props } from './ConversationDetailsHeader'; +import { ConversationDetailsHeader } from './ConversationDetailsHeader'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/ConversationDetailsHeader.tsx b/ts/components/conversation/conversation-details/ConversationDetailsHeader.tsx index 70348aafb..98c8c1998 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsHeader.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsHeader.tsx @@ -1,15 +1,16 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode, useState } from 'react'; +import type { ReactNode } from 'react'; +import React, { useState } from 'react'; import { Avatar } from '../../Avatar'; import { AvatarLightbox } from '../../AvatarLightbox'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { Emojify } from '../Emojify'; import { GroupDescription } from '../GroupDescription'; -import { GroupV2Membership } from './ConversationDetailsMembershipList'; -import { LocalizerType } from '../../../types/Util'; +import type { GroupV2Membership } from './ConversationDetailsMembershipList'; +import type { LocalizerType } from '../../../types/Util'; import { bemGenerator } from './util'; export type Props = { diff --git a/ts/components/conversation/conversation-details/ConversationDetailsIcon.stories.tsx b/ts/components/conversation/conversation-details/ConversationDetailsIcon.stories.tsx index 53a872503..34202151e 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsIcon.stories.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsIcon.stories.tsx @@ -6,11 +6,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; -import { - ConversationDetailsIcon, - Props, - IconType, -} from './ConversationDetailsIcon'; +import type { Props } from './ConversationDetailsIcon'; +import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon'; const story = storiesOf( 'Components/Conversation/ConversationDetails/ConversationDetailIcon', diff --git a/ts/components/conversation/conversation-details/ConversationDetailsMediaList.stories.tsx b/ts/components/conversation/conversation-details/ConversationDetailsMediaList.stories.tsx index 622f69b6a..046025396 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsMediaList.stories.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsMediaList.stories.tsx @@ -9,15 +9,13 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { - ConversationDetailsMediaList, - Props, -} from './ConversationDetailsMediaList'; +import type { Props } from './ConversationDetailsMediaList'; +import { ConversationDetailsMediaList } from './ConversationDetailsMediaList'; import { createPreparedMediaItems, createRandomMedia, } from '../media-gallery/AttachmentSection.stories'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { MediaItemType } from '../../../types/MediaItem'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/ConversationDetailsMediaList.tsx b/ts/components/conversation/conversation-details/ConversationDetailsMediaList.tsx index 27a1fd166..84b49feea 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsMediaList.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsMediaList.tsx @@ -3,10 +3,10 @@ import React from 'react'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; -import { MediaItemType } from '../../../types/MediaItem'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { MediaItemType } from '../../../types/MediaItem'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { PanelSection } from './PanelSection'; import { bemGenerator } from './util'; diff --git a/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.stories.tsx b/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.stories.tsx index cd523b0a8..83eeeafca 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.stories.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.stories.tsx @@ -12,11 +12,11 @@ import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; -import { - ConversationDetailsMembershipList, +import type { Props, GroupV2Membership, } from './ConversationDetailsMembershipList'; +import { ConversationDetailsMembershipList } from './ConversationDetailsMembershipList'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.tsx b/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.tsx index fdf705e5d..be2d3f5e3 100644 --- a/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.tsx +++ b/ts/components/conversation/conversation-details/ConversationDetailsMembershipList.tsx @@ -3,12 +3,12 @@ import React from 'react'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; import { Avatar } from '../../Avatar'; import { Emojify } from '../Emojify'; import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { PanelRow } from './PanelRow'; import { PanelSection } from './PanelSection'; diff --git a/ts/components/conversation/conversation-details/ConversationNotificationsModal.tsx b/ts/components/conversation/conversation-details/ConversationNotificationsModal.tsx index c06ff6012..6e23b6577 100644 --- a/ts/components/conversation/conversation-details/ConversationNotificationsModal.tsx +++ b/ts/components/conversation/conversation-details/ConversationNotificationsModal.tsx @@ -3,7 +3,7 @@ import React, { useMemo, useState } from 'react'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; import { getMuteOptions } from '../../../util/getMuteOptions'; import { parseIntOrThrow } from '../../../util/parseIntOrThrow'; import { Checkbox } from '../../Checkbox'; diff --git a/ts/components/conversation/conversation-details/ConversationNotificationsSettings.tsx b/ts/components/conversation/conversation-details/ConversationNotificationsSettings.tsx index 9f5e0228e..e38f480c3 100644 --- a/ts/components/conversation/conversation-details/ConversationNotificationsSettings.tsx +++ b/ts/components/conversation/conversation-details/ConversationNotificationsSettings.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, useMemo } from 'react'; +import type { FunctionComponent } from 'react'; +import React, { useMemo } from 'react'; -import { ConversationTypeType } from '../../../state/ducks/conversations'; -import { LocalizerType } from '../../../types/Util'; +import type { ConversationTypeType } from '../../../state/ducks/conversations'; +import type { LocalizerType } from '../../../types/Util'; import { PanelSection } from './PanelSection'; import { PanelRow } from './PanelRow'; import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon'; diff --git a/ts/components/conversation/conversation-details/EditConversationAttributesModal.stories.tsx b/ts/components/conversation/conversation-details/EditConversationAttributesModal.stories.tsx index 92eba6f87..3f25491c5 100644 --- a/ts/components/conversation/conversation-details/EditConversationAttributesModal.stories.tsx +++ b/ts/components/conversation/conversation-details/EditConversationAttributesModal.stories.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ComponentProps } from 'react'; +import type { ComponentProps } from 'react'; +import React from 'react'; import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; diff --git a/ts/components/conversation/conversation-details/EditConversationAttributesModal.tsx b/ts/components/conversation/conversation-details/EditConversationAttributesModal.tsx index 6e2095533..0ffd6eb65 100644 --- a/ts/components/conversation/conversation-details/EditConversationAttributesModal.tsx +++ b/ts/components/conversation/conversation-details/EditConversationAttributesModal.tsx @@ -1,14 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { - FormEventHandler, - FunctionComponent, - useRef, - useState, -} from 'react'; +import type { FormEventHandler, FunctionComponent } from 'react'; +import React, { useRef, useState } from 'react'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; import { Modal } from '../../Modal'; import { AvatarEditor } from '../../AvatarEditor'; import { AvatarPreview } from '../../AvatarPreview'; @@ -17,13 +13,13 @@ import { Spinner } from '../../Spinner'; import { GroupDescriptionInput } from '../../GroupDescriptionInput'; import { GroupTitleInput } from '../../GroupTitleInput'; import { RequestState } from './util'; -import { +import type { AvatarDataType, DeleteAvatarFromDiskActionType, ReplaceAvatarActionType, SaveAvatarToDiskActionType, } from '../../../types/Avatar'; -import { AvatarColorType } from '../../../types/Colors'; +import type { AvatarColorType } from '../../../types/Colors'; type PropsType = { avatarColor?: AvatarColorType; diff --git a/ts/components/conversation/conversation-details/GroupLinkManagement.stories.tsx b/ts/components/conversation/conversation-details/GroupLinkManagement.stories.tsx index 2168d73d3..95d2ce0cb 100644 --- a/ts/components/conversation/conversation-details/GroupLinkManagement.stories.tsx +++ b/ts/components/conversation/conversation-details/GroupLinkManagement.stories.tsx @@ -8,9 +8,10 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { GroupLinkManagement, PropsType } from './GroupLinkManagement'; +import type { PropsType } from './GroupLinkManagement'; +import { GroupLinkManagement } from './GroupLinkManagement'; import { SignalService as Proto } from '../../../protobuf'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/GroupLinkManagement.tsx b/ts/components/conversation/conversation-details/GroupLinkManagement.tsx index bfee5873c..74a79e07e 100644 --- a/ts/components/conversation/conversation-details/GroupLinkManagement.tsx +++ b/ts/components/conversation/conversation-details/GroupLinkManagement.tsx @@ -5,8 +5,8 @@ import React from 'react'; import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon'; import { SignalService as Proto } from '../../../protobuf'; -import { ConversationType } from '../../../state/ducks/conversations'; -import { LocalizerType } from '../../../types/Util'; +import type { ConversationType } from '../../../state/ducks/conversations'; +import type { LocalizerType } from '../../../types/Util'; import { PanelRow } from './PanelRow'; import { PanelSection } from './PanelSection'; import { Select } from '../../Select'; diff --git a/ts/components/conversation/conversation-details/GroupV2Permissions.stories.tsx b/ts/components/conversation/conversation-details/GroupV2Permissions.stories.tsx index 95253795c..bc47273ee 100644 --- a/ts/components/conversation/conversation-details/GroupV2Permissions.stories.tsx +++ b/ts/components/conversation/conversation-details/GroupV2Permissions.stories.tsx @@ -8,8 +8,9 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { GroupV2Permissions, PropsType } from './GroupV2Permissions'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { PropsType } from './GroupV2Permissions'; +import { GroupV2Permissions } from './GroupV2Permissions'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/GroupV2Permissions.tsx b/ts/components/conversation/conversation-details/GroupV2Permissions.tsx index df3a53804..debd33890 100644 --- a/ts/components/conversation/conversation-details/GroupV2Permissions.tsx +++ b/ts/components/conversation/conversation-details/GroupV2Permissions.tsx @@ -3,8 +3,8 @@ import React from 'react'; -import { ConversationType } from '../../../state/ducks/conversations'; -import { LocalizerType } from '../../../types/Util'; +import type { ConversationType } from '../../../state/ducks/conversations'; +import type { LocalizerType } from '../../../types/Util'; import { getAccessControlOptions } from '../../../util/getAccessControlOptions'; import { SignalService as Proto } from '../../../protobuf'; diff --git a/ts/components/conversation/conversation-details/PanelRow.stories.tsx b/ts/components/conversation/conversation-details/PanelRow.stories.tsx index ae624cf08..3d6d2176f 100644 --- a/ts/components/conversation/conversation-details/PanelRow.stories.tsx +++ b/ts/components/conversation/conversation-details/PanelRow.stories.tsx @@ -8,7 +8,8 @@ import { action } from '@storybook/addon-actions'; import { boolean, text } from '@storybook/addon-knobs'; import { ConversationDetailsIcon, IconType } from './ConversationDetailsIcon'; -import { PanelRow, Props } from './PanelRow'; +import type { Props } from './PanelRow'; +import { PanelRow } from './PanelRow'; const story = storiesOf( 'Components/Conversation/ConversationDetails/PanelRow', diff --git a/ts/components/conversation/conversation-details/PanelSection.stories.tsx b/ts/components/conversation/conversation-details/PanelSection.stories.tsx index be4481412..f3f0eed5c 100644 --- a/ts/components/conversation/conversation-details/PanelSection.stories.tsx +++ b/ts/components/conversation/conversation-details/PanelSection.stories.tsx @@ -7,7 +7,8 @@ import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; import { boolean, text } from '@storybook/addon-knobs'; -import { PanelSection, Props } from './PanelSection'; +import type { Props } from './PanelSection'; +import { PanelSection } from './PanelSection'; import { PanelRow } from './PanelRow'; const story = storiesOf( diff --git a/ts/components/conversation/conversation-details/PendingInvites.stories.tsx b/ts/components/conversation/conversation-details/PendingInvites.stories.tsx index 0a9faf3ad..4c6d323d2 100644 --- a/ts/components/conversation/conversation-details/PendingInvites.stories.tsx +++ b/ts/components/conversation/conversation-details/PendingInvites.stories.tsx @@ -9,8 +9,9 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { PendingInvites, PropsType } from './PendingInvites'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { PropsType } from './PendingInvites'; +import { PendingInvites } from './PendingInvites'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/conversation-details/PendingInvites.tsx b/ts/components/conversation/conversation-details/PendingInvites.tsx index 4a4cc93d6..fef2d83e7 100644 --- a/ts/components/conversation/conversation-details/PendingInvites.tsx +++ b/ts/components/conversation/conversation-details/PendingInvites.tsx @@ -5,8 +5,8 @@ import React from 'react'; import classNames from 'classnames'; import _ from 'lodash'; -import { ConversationType } from '../../../state/ducks/conversations'; -import { LocalizerType } from '../../../types/Util'; +import type { ConversationType } from '../../../state/ducks/conversations'; +import type { LocalizerType } from '../../../types/Util'; import { Avatar } from '../../Avatar'; import { ConfirmationDialog } from '../../ConfirmationDialog'; import { PanelSection } from './PanelSection'; diff --git a/ts/components/conversation/media-gallery/AttachmentSection.stories.tsx b/ts/components/conversation/media-gallery/AttachmentSection.stories.tsx index 99fbdfd5e..5e343c31e 100644 --- a/ts/components/conversation/media-gallery/AttachmentSection.stories.tsx +++ b/ts/components/conversation/media-gallery/AttachmentSection.stories.tsx @@ -10,10 +10,11 @@ import { random, range, sample, sortBy } from 'lodash'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { MIMEType } from '../../../types/MIME'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { MIMEType } from '../../../types/MIME'; +import type { MediaItemType } from '../../../types/MediaItem'; -import { AttachmentSection, Props } from './AttachmentSection'; +import type { Props } from './AttachmentSection'; +import { AttachmentSection } from './AttachmentSection'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/media-gallery/AttachmentSection.tsx b/ts/components/conversation/media-gallery/AttachmentSection.tsx index 1e924c5b1..1c5b7a37e 100644 --- a/ts/components/conversation/media-gallery/AttachmentSection.tsx +++ b/ts/components/conversation/media-gallery/AttachmentSection.tsx @@ -4,11 +4,11 @@ import React from 'react'; import { DocumentListItem } from './DocumentListItem'; -import { ItemClickEvent } from './types/ItemClickEvent'; +import type { ItemClickEvent } from './types/ItemClickEvent'; import { MediaGridItem } from './MediaGridItem'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { MediaItemType } from '../../../types/MediaItem'; import { missingCaseError } from '../../../util/missingCaseError'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; import { getMessageTimestamp } from '../../../util/getMessageTimestamp'; export type Props = { diff --git a/ts/components/conversation/media-gallery/MediaGallery.stories.tsx b/ts/components/conversation/media-gallery/MediaGallery.stories.tsx index 22e14a221..c610fc1fa 100644 --- a/ts/components/conversation/media-gallery/MediaGallery.stories.tsx +++ b/ts/components/conversation/media-gallery/MediaGallery.stories.tsx @@ -15,7 +15,8 @@ import { days, now, } from './AttachmentSection.stories'; -import { MediaGallery, Props } from './MediaGallery'; +import type { Props } from './MediaGallery'; +import { MediaGallery } from './MediaGallery'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/media-gallery/MediaGallery.tsx b/ts/components/conversation/media-gallery/MediaGallery.tsx index c7275963e..d67b7b332 100644 --- a/ts/components/conversation/media-gallery/MediaGallery.tsx +++ b/ts/components/conversation/media-gallery/MediaGallery.tsx @@ -9,12 +9,12 @@ import moment from 'moment'; import { AttachmentSection } from './AttachmentSection'; import { EmptyState } from './EmptyState'; import { groupMediaItemsByDate } from './groupMediaItemsByDate'; -import { ItemClickEvent } from './types/ItemClickEvent'; +import type { ItemClickEvent } from './types/ItemClickEvent'; import { missingCaseError } from '../../../util/missingCaseError'; -import { LocalizerType } from '../../../types/Util'; +import type { LocalizerType } from '../../../types/Util'; import { getMessageTimestamp } from '../../../util/getMessageTimestamp'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { MediaItemType } from '../../../types/MediaItem'; export type Props = { documents: Array; diff --git a/ts/components/conversation/media-gallery/MediaGridItem.stories.tsx b/ts/components/conversation/media-gallery/MediaGridItem.stories.tsx index a9a5d4eee..4b8c2eb59 100644 --- a/ts/components/conversation/media-gallery/MediaGridItem.stories.tsx +++ b/ts/components/conversation/media-gallery/MediaGridItem.stories.tsx @@ -8,11 +8,12 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; -import { MediaItemType } from '../../../types/MediaItem'; -import { AttachmentType } from '../../../types/Attachment'; +import type { MediaItemType } from '../../../types/MediaItem'; +import type { AttachmentType } from '../../../types/Attachment'; import { stringToMIMEType } from '../../../types/MIME'; -import { MediaGridItem, Props } from './MediaGridItem'; +import type { Props } from './MediaGridItem'; +import { MediaGridItem } from './MediaGridItem'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversation/media-gallery/MediaGridItem.tsx b/ts/components/conversation/media-gallery/MediaGridItem.tsx index 913ee4c09..ecc0e2b01 100644 --- a/ts/components/conversation/media-gallery/MediaGridItem.tsx +++ b/ts/components/conversation/media-gallery/MediaGridItem.tsx @@ -8,8 +8,8 @@ import { isImageTypeSupported, isVideoTypeSupported, } from '../../../util/GoogleChrome'; -import { LocalizerType } from '../../../types/Util'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { LocalizerType } from '../../../types/Util'; +import type { MediaItemType } from '../../../types/MediaItem'; import * as log from '../../../logging/log'; export type Props = { diff --git a/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts b/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts index dce498b4b..fbcb798df 100644 --- a/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts +++ b/ts/components/conversation/media-gallery/groupMediaItemsByDate.ts @@ -5,7 +5,7 @@ import moment from 'moment'; import { compact, groupBy, sortBy } from 'lodash'; import * as log from '../../../logging/log'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { MediaItemType } from '../../../types/MediaItem'; import { getMessageTimestamp } from '../../../util/getMessageTimestamp'; import { missingCaseError } from '../../../util/missingCaseError'; diff --git a/ts/components/conversation/media-gallery/types/ItemClickEvent.ts b/ts/components/conversation/media-gallery/types/ItemClickEvent.ts index 2eeec892f..bf51c6a5b 100644 --- a/ts/components/conversation/media-gallery/types/ItemClickEvent.ts +++ b/ts/components/conversation/media-gallery/types/ItemClickEvent.ts @@ -1,8 +1,8 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AttachmentType } from '../../../../types/Attachment'; -import { Message } from './Message'; +import type { AttachmentType } from '../../../../types/Attachment'; +import type { Message } from './Message'; export type ItemClickEvent = { message: Message; diff --git a/ts/components/conversation/media-gallery/types/Message.ts b/ts/components/conversation/media-gallery/types/Message.ts index 99eadfcf8..b6b60056a 100644 --- a/ts/components/conversation/media-gallery/types/Message.ts +++ b/ts/components/conversation/media-gallery/types/Message.ts @@ -1,7 +1,7 @@ // Copyright 2018-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AttachmentType } from '../../../../types/Attachment'; +import type { AttachmentType } from '../../../../types/Attachment'; export type Message = { id: string; diff --git a/ts/components/conversationList/BaseConversationListItem.tsx b/ts/components/conversationList/BaseConversationListItem.tsx index 487829b3e..5419bda85 100644 --- a/ts/components/conversationList/BaseConversationListItem.tsx +++ b/ts/components/conversationList/BaseConversationListItem.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode, FunctionComponent, useMemo } from 'react'; +import type { ReactNode, FunctionComponent } from 'react'; +import React, { useMemo } from 'react'; import classNames from 'classnames'; import { isBoolean, isNumber } from 'lodash'; import { v4 as uuid } from 'uuid'; @@ -10,8 +11,8 @@ import { Avatar, AvatarSize } from '../Avatar'; import { Timestamp } from '../conversation/Timestamp'; import { isConversationUnread } from '../../util/isConversationUnread'; import { cleanId } from '../_util'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; const BASE_CLASS_NAME = 'module-conversation-list__item--contact-or-conversation'; diff --git a/ts/components/conversationList/ContactCheckbox.tsx b/ts/components/conversationList/ContactCheckbox.tsx index 5f88ae993..2967953aa 100644 --- a/ts/components/conversationList/ContactCheckbox.tsx +++ b/ts/components/conversationList/ContactCheckbox.tsx @@ -1,14 +1,15 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React from 'react'; import { BaseConversationListItem, HEADER_CONTACT_NAME_CLASS_NAME, } from './BaseConversationListItem'; -import { ConversationType } from '../../state/ducks/conversations'; -import { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; import { ContactName } from '../conversation/ContactName'; import { About } from '../conversation/About'; diff --git a/ts/components/conversationList/ContactListItem.tsx b/ts/components/conversationList/ContactListItem.tsx index 93d70cb0f..92dd1e2d1 100644 --- a/ts/components/conversationList/ContactListItem.tsx +++ b/ts/components/conversationList/ContactListItem.tsx @@ -1,14 +1,15 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; import { BaseConversationListItem, HEADER_CONTACT_NAME_CLASS_NAME, } from './BaseConversationListItem'; -import { ConversationType } from '../../state/ducks/conversations'; -import { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; import { ContactName } from '../conversation/ContactName'; import { About } from '../conversation/About'; diff --git a/ts/components/conversationList/ConversationListItem.tsx b/ts/components/conversationList/ConversationListItem.tsx index 9c32abb7d..0e02f749e 100644 --- a/ts/components/conversationList/ConversationListItem.tsx +++ b/ts/components/conversationList/ConversationListItem.tsx @@ -1,7 +1,8 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useCallback, FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React, { useCallback } from 'react'; import classNames from 'classnames'; import { @@ -14,8 +15,8 @@ import { MessageBody } from '../conversation/MessageBody'; import { ContactName } from '../conversation/ContactName'; import { TypingAnimation } from '../conversation/TypingAnimation'; -import { LocalizerType } from '../../types/Util'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { LocalizerType } from '../../types/Util'; +import type { ConversationType } from '../../state/ducks/conversations'; const MESSAGE_STATUS_ICON_CLASS_NAME = `${MESSAGE_TEXT_CLASS_NAME}__status-icon`; diff --git a/ts/components/conversationList/CreateNewGroupButton.tsx b/ts/components/conversationList/CreateNewGroupButton.tsx index f48c957da..c8524d4c3 100644 --- a/ts/components/conversationList/CreateNewGroupButton.tsx +++ b/ts/components/conversationList/CreateNewGroupButton.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; import { BaseConversationListItem } from './BaseConversationListItem'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; type PropsType = { i18n: LocalizerType; diff --git a/ts/components/conversationList/MessageBodyHighlight.stories.tsx b/ts/components/conversationList/MessageBodyHighlight.stories.tsx index 81389aadb..111238ba8 100644 --- a/ts/components/conversationList/MessageBodyHighlight.stories.tsx +++ b/ts/components/conversationList/MessageBodyHighlight.stories.tsx @@ -7,7 +7,8 @@ import { text, withKnobs } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { MessageBodyHighlight, Props } from './MessageBodyHighlight'; +import type { Props } from './MessageBodyHighlight'; +import { MessageBodyHighlight } from './MessageBodyHighlight'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversationList/MessageBodyHighlight.tsx b/ts/components/conversationList/MessageBodyHighlight.tsx index 50fb16638..ae20c78d4 100644 --- a/ts/components/conversationList/MessageBodyHighlight.tsx +++ b/ts/components/conversationList/MessageBodyHighlight.tsx @@ -1,7 +1,8 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactNode } from 'react'; +import type { ReactNode } from 'react'; +import React from 'react'; import { MESSAGE_TEXT_CLASS_NAME } from './BaseConversationListItem'; import { AtMentionify } from '../conversation/AtMentionify'; @@ -9,9 +10,9 @@ import { MessageBody } from '../conversation/MessageBody'; import { Emojify } from '../conversation/Emojify'; import { AddNewLines } from '../conversation/AddNewLines'; -import { SizeClassType } from '../emoji/lib'; +import type { SizeClassType } from '../emoji/lib'; -import { +import type { BodyRangesType, LocalizerType, RenderTextCallbackType, diff --git a/ts/components/conversationList/MessageSearchResult.stories.tsx b/ts/components/conversationList/MessageSearchResult.stories.tsx index e278692eb..e630e268a 100644 --- a/ts/components/conversationList/MessageSearchResult.stories.tsx +++ b/ts/components/conversationList/MessageSearchResult.stories.tsx @@ -8,7 +8,8 @@ import { boolean, text, withKnobs } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { MessageSearchResult, PropsType } from './MessageSearchResult'; +import type { PropsType } from './MessageSearchResult'; +import { MessageSearchResult } from './MessageSearchResult'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/conversationList/MessageSearchResult.tsx b/ts/components/conversationList/MessageSearchResult.tsx index 321debe9d..3c45a7e4c 100644 --- a/ts/components/conversationList/MessageSearchResult.tsx +++ b/ts/components/conversationList/MessageSearchResult.tsx @@ -1,16 +1,17 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { useCallback, FunctionComponent, ReactNode } from 'react'; +import type { FunctionComponent, ReactNode } from 'react'; +import React, { useCallback } from 'react'; import { escapeRegExp } from 'lodash'; import { MessageBodyHighlight } from './MessageBodyHighlight'; import { ContactName } from '../conversation/ContactName'; import { assert } from '../../util/assert'; -import { BodyRangesType, LocalizerType } from '../../types/Util'; +import type { BodyRangesType, LocalizerType } from '../../types/Util'; import { BaseConversationListItem } from './BaseConversationListItem'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; export type PropsDataType = { isSelected?: boolean; diff --git a/ts/components/conversationList/SearchResultsLoadingFakeHeader.tsx b/ts/components/conversationList/SearchResultsLoadingFakeHeader.tsx index 933e7a7db..2bf3c88e5 100644 --- a/ts/components/conversationList/SearchResultsLoadingFakeHeader.tsx +++ b/ts/components/conversationList/SearchResultsLoadingFakeHeader.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; type PropsType = Record; diff --git a/ts/components/conversationList/SearchResultsLoadingFakeRow.tsx b/ts/components/conversationList/SearchResultsLoadingFakeRow.tsx index af18a9c70..4bc96ee82 100644 --- a/ts/components/conversationList/SearchResultsLoadingFakeRow.tsx +++ b/ts/components/conversationList/SearchResultsLoadingFakeRow.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; type PropsType = Record; diff --git a/ts/components/conversationList/StartNewConversation.tsx b/ts/components/conversationList/StartNewConversation.tsx index 29ab0a375..89b78c48f 100644 --- a/ts/components/conversationList/StartNewConversation.tsx +++ b/ts/components/conversationList/StartNewConversation.tsx @@ -1,14 +1,15 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent, useCallback } from 'react'; +import type { FunctionComponent } from 'react'; +import React, { useCallback } from 'react'; import { BaseConversationListItem, MESSAGE_TEXT_CLASS_NAME, } from './BaseConversationListItem'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { AvatarColors } from '../../types/Colors'; const TEXT_CLASS_NAME = `${MESSAGE_TEXT_CLASS_NAME}__start-new-conversation`; diff --git a/ts/components/emoji/Emoji.stories.tsx b/ts/components/emoji/Emoji.stories.tsx index 85c609833..3ab2a12ab 100644 --- a/ts/components/emoji/Emoji.stories.tsx +++ b/ts/components/emoji/Emoji.stories.tsx @@ -4,7 +4,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; import { select, text } from '@storybook/addon-knobs'; -import { Emoji, EmojiSizes, Props } from './Emoji'; +import type { Props } from './Emoji'; +import { Emoji, EmojiSizes } from './Emoji'; const story = storiesOf('Components/Emoji/Emoji', module); diff --git a/ts/components/emoji/Emoji.tsx b/ts/components/emoji/Emoji.tsx index 3e7ae9c95..91390e24e 100644 --- a/ts/components/emoji/Emoji.tsx +++ b/ts/components/emoji/Emoji.tsx @@ -3,7 +3,8 @@ import * as React from 'react'; import classNames from 'classnames'; -import { emojiToImage, getImagePath, SkinToneKey } from './lib'; +import type { SkinToneKey } from './lib'; +import { emojiToImage, getImagePath } from './lib'; export const EmojiSizes = [16, 18, 20, 24, 28, 32, 48, 64, 66] as const; diff --git a/ts/components/emoji/EmojiButton.tsx b/ts/components/emoji/EmojiButton.tsx index ece721426..4e8b7dd01 100644 --- a/ts/components/emoji/EmojiButton.tsx +++ b/ts/components/emoji/EmojiButton.tsx @@ -7,8 +7,9 @@ import { get, noop } from 'lodash'; import { Manager, Popper, Reference } from 'react-popper'; import { createPortal } from 'react-dom'; import { Emoji } from './Emoji'; -import { EmojiPicker, Props as EmojiPickerProps } from './EmojiPicker'; -import { LocalizerType } from '../../types/Util'; +import type { Props as EmojiPickerProps } from './EmojiPicker'; +import { EmojiPicker } from './EmojiPicker'; +import type { LocalizerType } from '../../types/Util'; export type OwnProps = { readonly closeOnPick?: boolean; diff --git a/ts/components/emoji/EmojiPicker.tsx b/ts/components/emoji/EmojiPicker.tsx index 461ea6168..48acc2682 100644 --- a/ts/components/emoji/EmojiPicker.tsx +++ b/ts/components/emoji/EmojiPicker.tsx @@ -3,12 +3,11 @@ import * as React from 'react'; import classNames from 'classnames'; -import { - AutoSizer, - Grid, +import type { GridCellRenderer, SectionRenderedParams, } from 'react-virtualized'; +import { AutoSizer, Grid } from 'react-virtualized'; import { chunk, debounce, @@ -22,7 +21,7 @@ import FocusTrap from 'focus-trap-react'; import { Emoji } from './Emoji'; import { dataByCategory, search } from './lib'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type EmojiPickDataType = { skinTone?: number; diff --git a/ts/components/leftPane/LeftPaneArchiveHelper.tsx b/ts/components/leftPane/LeftPaneArchiveHelper.tsx index 3d00f3dd0..f304f5060 100644 --- a/ts/components/leftPane/LeftPaneArchiveHelper.tsx +++ b/ts/components/leftPane/LeftPaneArchiveHelper.tsx @@ -1,14 +1,17 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild } from 'react'; +import type { ReactChild } from 'react'; +import React from 'react'; import { last } from 'lodash'; -import { LeftPaneHelper, ToFindType } from './LeftPaneHelper'; +import type { ToFindType } from './LeftPaneHelper'; +import { LeftPaneHelper } from './LeftPaneHelper'; import { getConversationInDirection } from './getConversationInDirection'; -import { Row, RowType } from '../ConversationList'; -import { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; -import { LocalizerType } from '../../types/Util'; +import type { Row } from '../ConversationList'; +import { RowType } from '../ConversationList'; +import type { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; +import type { LocalizerType } from '../../types/Util'; export type LeftPaneArchivePropsType = { archivedConversations: ReadonlyArray; diff --git a/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx b/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx index 3247f9924..e5d6b2b4f 100644 --- a/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx +++ b/ts/components/leftPane/LeftPaneChooseGroupMembersHelper.tsx @@ -1,11 +1,13 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild, ChangeEvent } from 'react'; +import type { ReactChild, ChangeEvent } from 'react'; +import React from 'react'; import { LeftPaneHelper } from './LeftPaneHelper'; -import { Row, RowType } from '../ConversationList'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { Row } from '../ConversationList'; +import { RowType } from '../ConversationList'; +import type { ConversationType } from '../../state/ducks/conversations'; import { ContactCheckboxDisabledReason } from '../conversationList/ContactCheckbox'; import { ContactPills } from '../ContactPills'; import { ContactPill } from '../ContactPill'; @@ -15,7 +17,7 @@ import { AddGroupMemberErrorDialogMode, } from '../AddGroupMemberErrorDialog'; import { Button } from '../Button'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { getGroupSizeRecommendedLimit, getGroupSizeHardLimit, diff --git a/ts/components/leftPane/LeftPaneComposeHelper.tsx b/ts/components/leftPane/LeftPaneComposeHelper.tsx index a89f88389..f3db83201 100644 --- a/ts/components/leftPane/LeftPaneComposeHelper.tsx +++ b/ts/components/leftPane/LeftPaneComposeHelper.tsx @@ -1,15 +1,17 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild, ChangeEvent } from 'react'; -import { PhoneNumber } from 'google-libphonenumber'; +import type { ReactChild, ChangeEvent } from 'react'; +import React from 'react'; +import type { PhoneNumber } from 'google-libphonenumber'; import { LeftPaneHelper } from './LeftPaneHelper'; -import { Row, RowType } from '../ConversationList'; -import { PropsDataType as ContactListItemPropsType } from '../conversationList/ContactListItem'; -import { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; +import type { Row } from '../ConversationList'; +import { RowType } from '../ConversationList'; +import type { PropsDataType as ContactListItemPropsType } from '../conversationList/ContactListItem'; +import type { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; import { SearchInput } from '../SearchInput'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { instance as phoneNumberInstance, PhoneNumberFormat, diff --git a/ts/components/leftPane/LeftPaneHelper.tsx b/ts/components/leftPane/LeftPaneHelper.tsx index 293b76bb6..321d9cd2d 100644 --- a/ts/components/leftPane/LeftPaneHelper.tsx +++ b/ts/components/leftPane/LeftPaneHelper.tsx @@ -1,11 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ChangeEvent, ReactChild } from 'react'; +import type { ChangeEvent, ReactChild } from 'react'; -import { Row } from '../ConversationList'; -import { LocalizerType } from '../../types/Util'; -import { +import type { Row } from '../ConversationList'; +import type { LocalizerType } from '../../types/Util'; +import type { DeleteAvatarFromDiskActionType, ReplaceAvatarActionType, SaveAvatarToDiskActionType, diff --git a/ts/components/leftPane/LeftPaneInboxHelper.tsx b/ts/components/leftPane/LeftPaneInboxHelper.tsx index 8620a886b..712bf792e 100644 --- a/ts/components/leftPane/LeftPaneInboxHelper.tsx +++ b/ts/components/leftPane/LeftPaneInboxHelper.tsx @@ -2,14 +2,17 @@ // SPDX-License-Identifier: AGPL-3.0-only import { last } from 'lodash'; -import React, { ReactChild } from 'react'; +import type { ReactChild } from 'react'; +import React from 'react'; import { Intl } from '../Intl'; -import { LeftPaneHelper, ToFindType } from './LeftPaneHelper'; +import type { ToFindType } from './LeftPaneHelper'; +import { LeftPaneHelper } from './LeftPaneHelper'; import { getConversationInDirection } from './getConversationInDirection'; -import { Row, RowType } from '../ConversationList'; -import { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; -import { LocalizerType } from '../../types/Util'; +import type { Row } from '../ConversationList'; +import { RowType } from '../ConversationList'; +import type { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; +import type { LocalizerType } from '../../types/Util'; export type LeftPaneInboxPropsType = { conversations: ReadonlyArray; diff --git a/ts/components/leftPane/LeftPaneSearchHelper.tsx b/ts/components/leftPane/LeftPaneSearchHelper.tsx index 99565c059..3d54b7b7a 100644 --- a/ts/components/leftPane/LeftPaneSearchHelper.tsx +++ b/ts/components/leftPane/LeftPaneSearchHelper.tsx @@ -1,12 +1,15 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild } from 'react'; +import type { ReactChild } from 'react'; +import React from 'react'; -import { LeftPaneHelper, ToFindType } from './LeftPaneHelper'; -import { LocalizerType } from '../../types/Util'; -import { Row, RowType } from '../ConversationList'; -import { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; +import type { ToFindType } from './LeftPaneHelper'; +import { LeftPaneHelper } from './LeftPaneHelper'; +import type { LocalizerType } from '../../types/Util'; +import type { Row } from '../ConversationList'; +import { RowType } from '../ConversationList'; +import type { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; import { Intl } from '../Intl'; import { Emojify } from '../conversation/Emojify'; diff --git a/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx b/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx index 946bda797..34e0ddf3b 100644 --- a/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx +++ b/ts/components/leftPane/LeftPaneSetGroupMetadataHelper.tsx @@ -1,13 +1,15 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactChild } from 'react'; +import type { ReactChild } from 'react'; +import React from 'react'; import { LeftPaneHelper } from './LeftPaneHelper'; -import { Row, RowType } from '../ConversationList'; -import { PropsDataType as ContactListItemPropsType } from '../conversationList/ContactListItem'; +import type { Row } from '../ConversationList'; +import { RowType } from '../ConversationList'; +import type { PropsDataType as ContactListItemPropsType } from '../conversationList/ContactListItem'; import { DisappearingTimerSelect } from '../DisappearingTimerSelect'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; import { Alert } from '../Alert'; import { AvatarEditor } from '../AvatarEditor'; import { AvatarPreview } from '../AvatarPreview'; @@ -15,7 +17,7 @@ import { Spinner } from '../Spinner'; import { Button } from '../Button'; import { Modal } from '../Modal'; import { GroupTitleInput } from '../GroupTitleInput'; -import { +import type { AvatarDataType, DeleteAvatarFromDiskActionType, ReplaceAvatarActionType, diff --git a/ts/components/leftPane/getConversationInDirection.ts b/ts/components/leftPane/getConversationInDirection.ts index 1220aef80..0d6609b1b 100644 --- a/ts/components/leftPane/getConversationInDirection.ts +++ b/ts/components/leftPane/getConversationInDirection.ts @@ -3,9 +3,10 @@ import { find as findFirst, findLast, first, last } from 'lodash'; -import { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; +import type { PropsData as ConversationListItemPropsType } from '../conversationList/ConversationListItem'; import { isConversationUnread } from '../../util/isConversationUnread'; -import { FindDirection, ToFindType } from './LeftPaneHelper'; +import type { ToFindType } from './LeftPaneHelper'; +import { FindDirection } from './LeftPaneHelper'; /** * This will look up or down in an array of conversations for the next one to select. diff --git a/ts/components/stickers/StickerButton.stories.tsx b/ts/components/stickers/StickerButton.stories.tsx index b504f7bf3..351fc781a 100644 --- a/ts/components/stickers/StickerButton.stories.tsx +++ b/ts/components/stickers/StickerButton.stories.tsx @@ -8,7 +8,8 @@ import { boolean } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, StickerButton } from './StickerButton'; +import type { Props } from './StickerButton'; +import { StickerButton } from './StickerButton'; import { createPack, sticker1, diff --git a/ts/components/stickers/StickerButton.tsx b/ts/components/stickers/StickerButton.tsx index db4e7a5e9..b8879cca7 100644 --- a/ts/components/stickers/StickerButton.tsx +++ b/ts/components/stickers/StickerButton.tsx @@ -8,8 +8,8 @@ import { Manager, Popper, Reference } from 'react-popper'; import { createPortal } from 'react-dom'; import { StickerPicker } from './StickerPicker'; import { countStickers } from './lib'; -import { StickerPackType, StickerType } from '../../state/ducks/stickers'; -import { LocalizerType } from '../../types/Util'; +import type { StickerPackType, StickerType } from '../../state/ducks/stickers'; +import type { LocalizerType } from '../../types/Util'; import { offsetDistanceModifier } from '../../util/popperUtil'; export type OwnProps = { diff --git a/ts/components/stickers/StickerManager.stories.tsx b/ts/components/stickers/StickerManager.stories.tsx index eaffa7968..72111f2c6 100644 --- a/ts/components/stickers/StickerManager.stories.tsx +++ b/ts/components/stickers/StickerManager.stories.tsx @@ -7,7 +7,8 @@ import { action } from '@storybook/addon-actions'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, StickerManager } from './StickerManager'; +import type { Props } from './StickerManager'; +import { StickerManager } from './StickerManager'; import { createPack, sticker1, sticker2 } from './StickerPicker.stories'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/stickers/StickerManager.tsx b/ts/components/stickers/StickerManager.tsx index 7c2f7feb7..64eba4ba7 100644 --- a/ts/components/stickers/StickerManager.tsx +++ b/ts/components/stickers/StickerManager.tsx @@ -5,8 +5,8 @@ import * as React from 'react'; import classNames from 'classnames'; import { StickerManagerPackRow } from './StickerManagerPackRow'; import { StickerPreviewModal } from './StickerPreviewModal'; -import { LocalizerType } from '../../types/Util'; -import { StickerPackType } from '../../state/ducks/stickers'; +import type { LocalizerType } from '../../types/Util'; +import type { StickerPackType } from '../../state/ducks/stickers'; export type OwnProps = { readonly installedPacks: ReadonlyArray; diff --git a/ts/components/stickers/StickerManagerPackRow.tsx b/ts/components/stickers/StickerManagerPackRow.tsx index eb1642c8d..905c5fae9 100644 --- a/ts/components/stickers/StickerManagerPackRow.tsx +++ b/ts/components/stickers/StickerManagerPackRow.tsx @@ -4,8 +4,8 @@ import * as React from 'react'; import { StickerPackInstallButton } from './StickerPackInstallButton'; import { ConfirmationDialog } from '../ConfirmationDialog'; -import { LocalizerType } from '../../types/Util'; -import { StickerPackType } from '../../state/ducks/stickers'; +import type { LocalizerType } from '../../types/Util'; +import type { StickerPackType } from '../../state/ducks/stickers'; export type OwnProps = { readonly i18n: LocalizerType; diff --git a/ts/components/stickers/StickerPackInstallButton.tsx b/ts/components/stickers/StickerPackInstallButton.tsx index 120eb4d8e..c2bef2d3e 100644 --- a/ts/components/stickers/StickerPackInstallButton.tsx +++ b/ts/components/stickers/StickerPackInstallButton.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import classNames from 'classnames'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export type OwnProps = { readonly installed: boolean; diff --git a/ts/components/stickers/StickerPicker.stories.tsx b/ts/components/stickers/StickerPicker.stories.tsx index 9c0a9e811..c878efde0 100644 --- a/ts/components/stickers/StickerPicker.stories.tsx +++ b/ts/components/stickers/StickerPicker.stories.tsx @@ -9,8 +9,9 @@ import { boolean } from '@storybook/addon-knobs'; import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; -import { Props, StickerPicker } from './StickerPicker'; -import { StickerPackType, StickerType } from '../../state/ducks/stickers'; +import type { Props } from './StickerPicker'; +import { StickerPicker } from './StickerPicker'; +import type { StickerPackType, StickerType } from '../../state/ducks/stickers'; const i18n = setupI18n('en', enMessages); diff --git a/ts/components/stickers/StickerPicker.tsx b/ts/components/stickers/StickerPicker.tsx index f3cbd6f9c..7be67aa0c 100644 --- a/ts/components/stickers/StickerPicker.tsx +++ b/ts/components/stickers/StickerPicker.tsx @@ -6,8 +6,8 @@ import classNames from 'classnames'; import FocusTrap from 'focus-trap-react'; import { useRestoreFocus } from '../../hooks/useRestoreFocus'; -import { StickerPackType, StickerType } from '../../state/ducks/stickers'; -import { LocalizerType } from '../../types/Util'; +import type { StickerPackType, StickerType } from '../../state/ducks/stickers'; +import type { LocalizerType } from '../../types/Util'; export type OwnProps = { readonly i18n: LocalizerType; diff --git a/ts/components/stickers/StickerPreviewModal.tsx b/ts/components/stickers/StickerPreviewModal.tsx index 6e7ecc477..bc5dff2da 100644 --- a/ts/components/stickers/StickerPreviewModal.tsx +++ b/ts/components/stickers/StickerPreviewModal.tsx @@ -7,8 +7,8 @@ import { isNumber, range } from 'lodash'; import classNames from 'classnames'; import { StickerPackInstallButton } from './StickerPackInstallButton'; import { ConfirmationDialog } from '../ConfirmationDialog'; -import { LocalizerType } from '../../types/Util'; -import { StickerPackType } from '../../state/ducks/stickers'; +import type { LocalizerType } from '../../types/Util'; +import type { StickerPackType } from '../../state/ducks/stickers'; import { Spinner } from '../Spinner'; import { useRestoreFocus } from '../../hooks/useRestoreFocus'; diff --git a/ts/components/stickers/lib.ts b/ts/components/stickers/lib.ts index 827e2a0d8..122d36a0b 100644 --- a/ts/components/stickers/lib.ts +++ b/ts/components/stickers/lib.ts @@ -1,7 +1,7 @@ // Copyright 2019-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { StickerPackType } from '../../state/ducks/stickers'; +import type { StickerPackType } from '../../state/ducks/stickers'; // This function exists to force stickers to be counted consistently wherever // they are counted (TypeScript ensures that all data is named and provided) diff --git a/ts/context/Crypto.ts b/ts/context/Crypto.ts index 5925b2a5b..8a55eb86c 100644 --- a/ts/context/Crypto.ts +++ b/ts/context/Crypto.ts @@ -4,10 +4,12 @@ /* eslint-disable class-methods-use-this */ import { Buffer } from 'buffer'; -import crypto, { Decipher } from 'crypto'; +import type { Decipher } from 'crypto'; +import crypto from 'crypto'; import { strictAssert } from '../util/assert'; -import { HashType, CipherType } from '../types/Crypto'; +import type { HashType } from '../types/Crypto'; +import { CipherType } from '../types/Crypto'; const AUTH_TAG_SIZE = 16; diff --git a/ts/context/createNativeThemeListener.ts b/ts/context/createNativeThemeListener.ts index 526f966db..925a1bf0c 100644 --- a/ts/context/createNativeThemeListener.ts +++ b/ts/context/createNativeThemeListener.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable no-restricted-syntax */ -import { NativeThemeState } from '../types/NativeThemeNotifier.d'; +import type { NativeThemeState } from '../types/NativeThemeNotifier.d'; export type Callback = (change: NativeThemeState) => void; diff --git a/ts/groupChange.ts b/ts/groupChange.ts index c1ae6ac31..5636cd552 100644 --- a/ts/groupChange.ts +++ b/ts/groupChange.ts @@ -1,12 +1,12 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { FullJSXType } from './components/Intl'; -import { LocalizerType } from './types/Util'; -import { ReplacementValuesType } from './types/I18N'; +import type { FullJSXType } from './components/Intl'; +import type { LocalizerType } from './types/Util'; +import type { ReplacementValuesType } from './types/I18N'; import { missingCaseError } from './util/missingCaseError'; -import { GroupV2ChangeDetailType, GroupV2ChangeType } from './groups'; +import type { GroupV2ChangeDetailType, GroupV2ChangeType } from './groups'; import { SignalService as Proto } from './protobuf'; import * as log from './logging/log'; diff --git a/ts/groups.ts b/ts/groups.ts index 8278980cb..11631ea30 100644 --- a/ts/groups.ts +++ b/ts/groups.ts @@ -1,16 +1,16 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { Dictionary } from 'lodash'; import { compact, - Dictionary, difference, flatten, fromPairs, isNumber, values, } from 'lodash'; -import { ClientZkGroupCipher } from 'zkgroup'; +import type { ClientZkGroupCipher } from 'zkgroup'; import { v4 as getGuid } from 'uuid'; import LRU from 'lru-cache'; import * as log from './logging/log'; @@ -26,7 +26,7 @@ import { isMoreRecentThan } from './util/timestamp'; import * as durations from './util/durations'; import { normalizeUuid } from './util/normalizeUuid'; import { dropNull } from './util/dropNull'; -import { +import type { ConversationAttributesType, GroupV2MemberType, GroupV2PendingAdminApprovalType, @@ -54,14 +54,14 @@ import { deriveMasterKeyFromGroupV1, getRandomBytes, } from './Crypto'; -import { +import type { GroupCredentialsType, GroupLogResponseType, } from './textsecure/WebAPI'; -import MessageSender from './textsecure/SendMessage'; -import { CallbackResultType } from './textsecure/Types.d'; +import type MessageSender from './textsecure/SendMessage'; +import type { CallbackResultType } from './textsecure/Types.d'; import { CURRENT_SCHEMA_VERSION as MAX_MESSAGE_SCHEMA } from '../js/modules/types/message'; -import { ConversationModel } from './models/conversations'; +import type { ConversationModel } from './models/conversations'; import { getGroupSizeHardLimit } from './groups/limits'; import { ourProfileKeyService } from './services/ourProfileKey'; import { @@ -69,10 +69,11 @@ import { isGroupV2 as getIsGroupV2, isMe, } from './util/whatTypeOfConversation'; -import { handleMessageSend, SendTypesType } from './util/handleMessageSend'; +import type { SendTypesType } from './util/handleMessageSend'; +import { handleMessageSend } from './util/handleMessageSend'; import { getSendOptions } from './util/getSendOptions'; import * as Bytes from './Bytes'; -import { AvatarDataType } from './types/Avatar'; +import type { AvatarDataType } from './types/Avatar'; import { SignalService as Proto } from './protobuf'; import AccessRequiredEnum = Proto.AccessControl.AccessRequired; diff --git a/ts/groups/limits.ts b/ts/groups/limits.ts index 7004611ce..9f85dd607 100644 --- a/ts/groups/limits.ts +++ b/ts/groups/limits.ts @@ -3,7 +3,8 @@ import { isNumber } from 'lodash'; import { parseIntOrThrow } from '../util/parseIntOrThrow'; -import { getValue, ConfigKeyType } from '../RemoteConfig'; +import type { ConfigKeyType } from '../RemoteConfig'; +import { getValue } from '../RemoteConfig'; function makeGetter(configKey: ConfigKeyType): (fallback?: number) => number { return fallback => { diff --git a/ts/hooks/useAnimated.tsx b/ts/hooks/useAnimated.tsx index e0d15df09..35c0cf1dd 100644 --- a/ts/hooks/useAnimated.tsx +++ b/ts/hooks/useAnimated.tsx @@ -2,12 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { useState } from 'react'; -import { - SpringValues, - useChain, - useSpring, - useSpringRef, -} from '@react-spring/web'; +import type { SpringValues } from '@react-spring/web'; +import { useChain, useSpring, useSpringRef } from '@react-spring/web'; export type ModalConfigType = { opacity: number; diff --git a/ts/hooks/useBoundActions.ts b/ts/hooks/useBoundActions.ts index c40d7c240..c1121294e 100644 --- a/ts/hooks/useBoundActions.ts +++ b/ts/hooks/useBoundActions.ts @@ -1,7 +1,8 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ActionCreatorsMapObject, bindActionCreators } from 'redux'; +import type { ActionCreatorsMapObject } from 'redux'; +import { bindActionCreators } from 'redux'; import { useDispatch } from 'react-redux'; import { useMemo } from 'react'; diff --git a/ts/hooks/useHasWrapped.ts b/ts/hooks/useHasWrapped.ts index 1f9a3cad3..a61cbfc71 100644 --- a/ts/hooks/useHasWrapped.ts +++ b/ts/hooks/useHasWrapped.ts @@ -1,7 +1,8 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { Ref, useEffect, useState } from 'react'; +import type { Ref } from 'react'; +import { useEffect, useState } from 'react'; import { first, last, noop } from 'lodash'; function getTop(element: Readonly): number { diff --git a/ts/jobs/Job.ts b/ts/jobs/Job.ts index b143e9d85..90a63a530 100644 --- a/ts/jobs/Job.ts +++ b/ts/jobs/Job.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ParsedJob } from './types'; +import type { ParsedJob } from './types'; /** * A single job instance. Shouldn't be instantiated directly, except by `JobQueue`. diff --git a/ts/jobs/JobQueue.ts b/ts/jobs/JobQueue.ts index 87e35bb23..fe1354bcc 100644 --- a/ts/jobs/JobQueue.ts +++ b/ts/jobs/JobQueue.ts @@ -7,7 +7,7 @@ import { noop } from 'lodash'; import { Job } from './Job'; import { JobError } from './JobError'; -import { ParsedJob, StoredJob, JobQueueStore } from './types'; +import type { ParsedJob, StoredJob, JobQueueStore } from './types'; import { assert } from '../util/assert'; import * as log from '../logging/log'; import { JobLogger } from './JobLogger'; diff --git a/ts/jobs/JobQueueDatabaseStore.ts b/ts/jobs/JobQueueDatabaseStore.ts index 37d718411..c9f3ca115 100644 --- a/ts/jobs/JobQueueDatabaseStore.ts +++ b/ts/jobs/JobQueueDatabaseStore.ts @@ -4,7 +4,7 @@ import { noop } from 'lodash'; import { AsyncQueue } from '../util/AsyncQueue'; import { concat, wrapPromise } from '../util/asyncIterables'; -import { JobQueueStore, StoredJob } from './types'; +import type { JobQueueStore, StoredJob } from './types'; import { formatJobForInsert } from './formatJobForInsert'; import databaseInterface from '../sql/Client'; import * as log from '../logging/log'; diff --git a/ts/jobs/helpers/addReportSpamJob.ts b/ts/jobs/helpers/addReportSpamJob.ts index 7eb142796..b6d0d8e10 100644 --- a/ts/jobs/helpers/addReportSpamJob.ts +++ b/ts/jobs/helpers/addReportSpamJob.ts @@ -3,7 +3,7 @@ import { assert } from '../../util/assert'; import * as log from '../../logging/log'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import type { reportSpamJobQueue } from '../reportSpamJobQueue'; export async function addReportSpamJob({ diff --git a/ts/jobs/helpers/readAndViewSyncHelpers.ts b/ts/jobs/helpers/readAndViewSyncHelpers.ts index 2838fc151..f37ff5bd9 100644 --- a/ts/jobs/helpers/readAndViewSyncHelpers.ts +++ b/ts/jobs/helpers/readAndViewSyncHelpers.ts @@ -4,7 +4,8 @@ import { chunk } from 'lodash'; import type { LoggerType } from '../../types/Logging'; import { getSendOptions } from '../../util/getSendOptions'; -import { handleMessageSend, SendTypesType } from '../../util/handleMessageSend'; +import type { SendTypesType } from '../../util/handleMessageSend'; +import { handleMessageSend } from '../../util/handleMessageSend'; import { isNotNil } from '../../util/isNotNil'; import { strictAssert } from '../../util/assert'; import { isRecord } from '../../util/isRecord'; diff --git a/ts/jobs/normalMessageSendJobQueue.ts b/ts/jobs/normalMessageSendJobQueue.ts index 36a464c05..2bc8486e7 100644 --- a/ts/jobs/normalMessageSendJobQueue.ts +++ b/ts/jobs/normalMessageSendJobQueue.ts @@ -35,7 +35,7 @@ import type { WhatIsThis } from '../window.d'; import type { ParsedJob } from './types'; import { JobQueue } from './JobQueue'; import { jobQueueDatabaseStore } from './JobQueueDatabaseStore'; -import { Job } from './Job'; +import type { Job } from './Job'; import { getHttpErrorCode } from './helpers/getHttpErrorCode'; const { diff --git a/ts/jobs/readSyncJobQueue.ts b/ts/jobs/readSyncJobQueue.ts index f375e52c1..2b2872113 100644 --- a/ts/jobs/readSyncJobQueue.ts +++ b/ts/jobs/readSyncJobQueue.ts @@ -6,8 +6,8 @@ import * as durations from '../util/durations'; import type { LoggerType } from '../types/Logging'; import { exponentialBackoffMaxAttempts } from '../util/exponentialBackoff'; +import type { SyncType } from './helpers/readAndViewSyncHelpers'; import { - SyncType, parseRawSyncDataArray, runReadOrViewSyncJob, } from './helpers/readAndViewSyncHelpers'; diff --git a/ts/jobs/viewSyncJobQueue.ts b/ts/jobs/viewSyncJobQueue.ts index 1c98dfe87..29659f544 100644 --- a/ts/jobs/viewSyncJobQueue.ts +++ b/ts/jobs/viewSyncJobQueue.ts @@ -6,8 +6,8 @@ import * as durations from '../util/durations'; import type { LoggerType } from '../types/Logging'; import { exponentialBackoffMaxAttempts } from '../util/exponentialBackoff'; +import type { SyncType } from './helpers/readAndViewSyncHelpers'; import { - SyncType, parseRawSyncDataArray, runReadOrViewSyncJob, } from './helpers/readAndViewSyncHelpers'; diff --git a/ts/linkPreviews/linkPreviewFetch.ts b/ts/linkPreviews/linkPreviewFetch.ts index 7b3f9a722..87f15a127 100644 --- a/ts/linkPreviews/linkPreviewFetch.ts +++ b/ts/linkPreviews/linkPreviewFetch.ts @@ -1,16 +1,16 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { RequestInit, Response } from 'node-fetch'; +import type { RequestInit, Response } from 'node-fetch'; import type { AbortSignal as AbortSignalForNodeFetch } from 'abort-controller'; +import type { MIMEType } from '../types/MIME'; import { IMAGE_GIF, IMAGE_ICO, IMAGE_JPEG, IMAGE_PNG, IMAGE_WEBP, - MIMEType, stringToMIMEType, } from '../types/MIME'; import * as log from '../logging/log'; diff --git a/ts/linkPreviews/shouldUseFullSizeLinkPreviewImage.ts b/ts/linkPreviews/shouldUseFullSizeLinkPreviewImage.ts index 0c5070653..6328caae7 100644 --- a/ts/linkPreviews/shouldUseFullSizeLinkPreviewImage.ts +++ b/ts/linkPreviews/shouldUseFullSizeLinkPreviewImage.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LinkPreviewType } from '../types/message/LinkPreviews'; +import type { LinkPreviewType } from '../types/message/LinkPreviews'; import { isImageAttachment } from '../types/Attachment'; const MINIMUM_FULL_SIZE_DIMENSION = 200; diff --git a/ts/logging/debuglogs.ts b/ts/logging/debuglogs.ts index f847226b6..3785b0245 100644 --- a/ts/logging/debuglogs.ts +++ b/ts/logging/debuglogs.ts @@ -7,14 +7,14 @@ import { z } from 'zod'; import FormData from 'form-data'; import { gzip } from 'zlib'; import pify from 'pify'; -import got, { Response } from 'got'; +import type { Response } from 'got'; +import got from 'got'; import { getUserAgent } from '../util/getUserAgent'; import { maybeParseUrl } from '../util/url'; import * as log from './log'; import { reallyJsonStringify } from '../util/reallyJsonStringify'; +import type { FetchLogIpcData, LogEntryType } from './shared'; import { - FetchLogIpcData, - LogEntryType, LogLevel, getLogLevelString, isFetchLogIpcData, diff --git a/ts/logging/log.ts b/ts/logging/log.ts index 0300de33b..37d0955c1 100644 --- a/ts/logging/log.ts +++ b/ts/logging/log.ts @@ -2,7 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { noop } from 'lodash'; -import { LogFunction, LogLevel } from '../types/Logging'; +import type { LogFunction } from '../types/Logging'; +import { LogLevel } from '../types/Logging'; type LogAtLevelFnType = ( level: LogLevel, diff --git a/ts/logging/main_process_logging.ts b/ts/logging/main_process_logging.ts index 785e0ce5d..95b86b703 100644 --- a/ts/logging/main_process_logging.ts +++ b/ts/logging/main_process_logging.ts @@ -8,7 +8,8 @@ import { join } from 'path'; import split2 from 'split2'; import { readdirSync, createReadStream, unlinkSync, writeFileSync } from 'fs'; -import { BrowserWindow, app, ipcMain as ipc } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { app, ipcMain as ipc } from 'electron'; import pinoms from 'pino-multi-stream'; import pino from 'pino'; import * as mkdirp from 'mkdirp'; @@ -23,14 +24,8 @@ import type { LoggerType } from '../types/Logging'; import * as log from './log'; import { Environment, getEnvironment } from '../environment'; -import { - FetchLogIpcData, - LogEntryType, - LogLevel, - cleanArgs, - getLogLevelString, - isLogEntry, -} from './shared'; +import type { FetchLogIpcData, LogEntryType } from './shared'; +import { LogLevel, cleanArgs, getLogLevelString, isLogEntry } from './shared'; declare global { // We want to extend `Console`, so we need an interface. diff --git a/ts/main/NativeThemeNotifier.ts b/ts/main/NativeThemeNotifier.ts index a92b6f870..3e3e33d6d 100644 --- a/ts/main/NativeThemeNotifier.ts +++ b/ts/main/NativeThemeNotifier.ts @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ipcMain as ipc, nativeTheme, BrowserWindow } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { ipcMain as ipc, nativeTheme } from 'electron'; -import { NativeThemeState } from '../types/NativeThemeNotifier.d'; +import type { NativeThemeState } from '../types/NativeThemeNotifier.d'; function getState(): NativeThemeState { return { diff --git a/ts/main/challengeMain.ts b/ts/main/challengeMain.ts index f01d91794..e38ff25fe 100644 --- a/ts/main/challengeMain.ts +++ b/ts/main/challengeMain.ts @@ -2,9 +2,10 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable no-console */ -import { ipcMain as ipc, IpcMainEvent } from 'electron'; +import type { IpcMainEvent } from 'electron'; +import { ipcMain as ipc } from 'electron'; -import { IPCRequest, IPCResponse, ChallengeResponse } from '../challenge'; +import type { IPCRequest, IPCResponse, ChallengeResponse } from '../challenge'; export class ChallengeMainHandler { private handlers: Array<(response: ChallengeResponse) => void> = []; diff --git a/ts/main/settingsChannel.ts b/ts/main/settingsChannel.ts index 7872e8f97..b19efa989 100644 --- a/ts/main/settingsChannel.ts +++ b/ts/main/settingsChannel.ts @@ -1,13 +1,14 @@ // Copyright 2017-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ipcMain as ipc, BrowserWindow, session } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { ipcMain as ipc, session } from 'electron'; import { userConfig } from '../../app/user_config'; import { ephemeralConfig } from '../../app/ephemeral_config'; import { installPermissionsHandler } from '../../app/permissions'; import { strictAssert } from '../util/assert'; -import { +import type { IPCEventsValuesType, IPCEventsCallbacksType, } from '../util/createIPCEvents'; diff --git a/ts/messageModifiers/AttachmentDownloads.ts b/ts/messageModifiers/AttachmentDownloads.ts index 17bd2ee90..1dae61c64 100644 --- a/ts/messageModifiers/AttachmentDownloads.ts +++ b/ts/messageModifiers/AttachmentDownloads.ts @@ -8,14 +8,14 @@ import dataInterface from '../sql/Client'; import * as durations from '../util/durations'; import { downloadAttachment } from '../util/downloadAttachment'; import * as Bytes from '../Bytes'; -import { +import type { AttachmentDownloadJobType, AttachmentDownloadJobTypeType, } from '../sql/Interface'; -import { MessageModel } from '../models/messages'; -import { AttachmentType } from '../types/Attachment'; -import { LoggerType } from '../types/Logging'; +import type { MessageModel } from '../models/messages'; +import type { AttachmentType } from '../types/Attachment'; +import type { LoggerType } from '../types/Logging'; import * as log from '../logging/log'; const { diff --git a/ts/messageModifiers/Deletes.ts b/ts/messageModifiers/Deletes.ts index 999abd27f..53d507709 100644 --- a/ts/messageModifiers/Deletes.ts +++ b/ts/messageModifiers/Deletes.ts @@ -4,7 +4,7 @@ /* eslint-disable max-classes-per-file */ import { Collection, Model } from 'backbone'; -import { MessageModel } from '../models/messages'; +import type { MessageModel } from '../models/messages'; import * as log from '../logging/log'; type DeleteAttributesType = { diff --git a/ts/messageModifiers/MessageReceipts.ts b/ts/messageModifiers/MessageReceipts.ts index 464f9a45b..f86838120 100644 --- a/ts/messageModifiers/MessageReceipts.ts +++ b/ts/messageModifiers/MessageReceipts.ts @@ -6,9 +6,9 @@ import { isEqual } from 'lodash'; import { Collection, Model } from 'backbone'; -import { ConversationModel } from '../models/conversations'; -import { MessageModel } from '../models/messages'; -import { MessageModelCollectionType } from '../model-types.d'; +import type { ConversationModel } from '../models/conversations'; +import type { MessageModel } from '../models/messages'; +import type { MessageModelCollectionType } from '../model-types.d'; import { isOutgoing } from '../state/selectors/message'; import { isDirectConversation } from '../util/whatTypeOfConversation'; import { getOwn } from '../util/getOwn'; diff --git a/ts/messageModifiers/MessageRequests.ts b/ts/messageModifiers/MessageRequests.ts index 5aa497423..322654174 100644 --- a/ts/messageModifiers/MessageRequests.ts +++ b/ts/messageModifiers/MessageRequests.ts @@ -4,7 +4,7 @@ /* eslint-disable max-classes-per-file */ import { Collection, Model } from 'backbone'; -import { ConversationModel } from '../models/conversations'; +import type { ConversationModel } from '../models/conversations'; import * as log from '../logging/log'; type MessageRequestAttributesType = { diff --git a/ts/messageModifiers/Reactions.ts b/ts/messageModifiers/Reactions.ts index 5d5fa1900..5886c0929 100644 --- a/ts/messageModifiers/Reactions.ts +++ b/ts/messageModifiers/Reactions.ts @@ -4,9 +4,9 @@ /* eslint-disable max-classes-per-file */ import { Collection, Model } from 'backbone'; -import { MessageModel } from '../models/messages'; +import type { MessageModel } from '../models/messages'; import { isOutgoing } from '../state/selectors/message'; -import { ReactionAttributesType } from '../model-types.d'; +import type { ReactionAttributesType } from '../model-types.d'; import * as log from '../logging/log'; export class ReactionModel extends Model {} diff --git a/ts/messageModifiers/ReadSyncs.ts b/ts/messageModifiers/ReadSyncs.ts index 1fafbddb3..d29eb8f52 100644 --- a/ts/messageModifiers/ReadSyncs.ts +++ b/ts/messageModifiers/ReadSyncs.ts @@ -5,7 +5,7 @@ import { Collection, Model } from 'backbone'; -import { MessageModel } from '../models/messages'; +import type { MessageModel } from '../models/messages'; import { isIncoming } from '../state/selectors/message'; import { isMessageUnread } from '../util/isMessageUnread'; import { notificationService } from '../services/notifications'; diff --git a/ts/messageModifiers/ViewOnceOpenSyncs.ts b/ts/messageModifiers/ViewOnceOpenSyncs.ts index eb2200154..fc832b0fc 100644 --- a/ts/messageModifiers/ViewOnceOpenSyncs.ts +++ b/ts/messageModifiers/ViewOnceOpenSyncs.ts @@ -4,7 +4,7 @@ /* eslint-disable max-classes-per-file */ import { Collection, Model } from 'backbone'; -import { MessageModel } from '../models/messages'; +import type { MessageModel } from '../models/messages'; import * as log from '../logging/log'; type ViewOnceOpenSyncAttributesType = { diff --git a/ts/messageModifiers/ViewSyncs.ts b/ts/messageModifiers/ViewSyncs.ts index ce418c8b7..e36a582fd 100644 --- a/ts/messageModifiers/ViewSyncs.ts +++ b/ts/messageModifiers/ViewSyncs.ts @@ -5,7 +5,7 @@ import { Collection, Model } from 'backbone'; -import { MessageModel } from '../models/messages'; +import type { MessageModel } from '../models/messages'; import { ReadStatus } from '../messages/MessageReadStatus'; import { markViewed } from '../services/MessageUpdater'; import { isIncoming } from '../state/selectors/message'; diff --git a/ts/messages/migrateLegacySendAttributes.ts b/ts/messages/migrateLegacySendAttributes.ts index 7d82f2642..fbf012ab6 100644 --- a/ts/messages/migrateLegacySendAttributes.ts +++ b/ts/messages/migrateLegacySendAttributes.ts @@ -6,10 +6,9 @@ import { getOwn } from '../util/getOwn'; import { map, concat, repeat, zipObject } from '../util/iterables'; import { isOutgoing } from '../state/selectors/message'; import type { CustomError, MessageAttributesType } from '../model-types.d'; +import type { SendState, SendStateByConversationId } from './MessageSendState'; import { - SendState, SendActionType, - SendStateByConversationId, sendStateReducer, SendStatus, } from './MessageSendState'; diff --git a/ts/models/conversations.ts b/ts/models/conversations.ts index aa534a84d..d8ec9345e 100644 --- a/ts/models/conversations.ts +++ b/ts/models/conversations.ts @@ -4,7 +4,7 @@ /* eslint-disable class-methods-use-this */ /* eslint-disable camelcase */ import { compact, isNumber } from 'lodash'; -import { +import type { ConversationAttributesType, ConversationModelCollectionType, LastMessageStatus, @@ -15,8 +15,10 @@ import { WhatIsThis, } from '../model-types.d'; import { getInitials } from '../util/getInitials'; -import { AttachmentType, isGIF } from '../types/Attachment'; -import { CallMode, CallHistoryDetailsType } from '../types/Calling'; +import type { AttachmentType } from '../types/Attachment'; +import { isGIF } from '../types/Attachment'; +import type { CallHistoryDetailsType } from '../types/Calling'; +import { CallMode } from '../types/Calling'; import * as EmbeddedContact from '../types/EmbeddedContact'; import * as Conversation from '../types/Conversation'; import * as Stickers from '../types/Stickers'; @@ -27,14 +29,14 @@ import type { StickerType, } from '../textsecure/SendMessage'; import createTaskWithTimeout from '../textsecure/TaskWithTimeout'; -import { CallbackResultType } from '../textsecure/Types.d'; -import { ConversationType } from '../state/ducks/conversations'; -import { +import type { CallbackResultType } from '../textsecure/Types.d'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { AvatarColorType, ConversationColorType, CustomColorType, } from '../types/Colors'; -import { MessageModel } from './messages'; +import type { MessageModel } from './messages'; import { strictAssert } from '../util/assert'; import { isMuted } from '../util/isMuted'; import { isConversationSMSOnly } from '../util/isConversationSMSOnly'; @@ -42,11 +44,12 @@ import { isConversationUnregistered } from '../util/isConversationUnregistered'; import { missingCaseError } from '../util/missingCaseError'; import { sniffImageMimeType } from '../util/sniffImageMimeType'; import { isValidE164 } from '../util/isValidE164'; -import { MIMEType, IMAGE_JPEG, IMAGE_GIF, IMAGE_WEBP } from '../types/MIME'; +import type { MIMEType } from '../types/MIME'; +import { IMAGE_JPEG, IMAGE_GIF, IMAGE_WEBP } from '../types/MIME'; import { UUID } from '../types/UUID'; import { deriveAccessKey, decryptProfileName, decryptProfile } from '../Crypto'; import * as Bytes from '../Bytes'; -import { BodyRangesType } from '../types/Util'; +import type { BodyRangesType } from '../types/Util'; import { getTextWithMentions } from '../util/getTextWithMentions'; import { migrateColor } from '../util/migrateColor'; import { isNotNil } from '../util/isNotNil'; @@ -73,7 +76,7 @@ import { zipObject, } from '../util/iterables'; import * as universalExpireTimer from '../util/universalExpireTimer'; -import { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions'; +import type { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions'; import { isDirectConversation, isGroupV1, @@ -89,7 +92,8 @@ import { } from '../state/selectors/message'; import { normalMessageSendJobQueue } from '../jobs/normalMessageSendJobQueue'; import { Deletes } from '../messageModifiers/Deletes'; -import { Reactions, ReactionModel } from '../messageModifiers/Reactions'; +import type { ReactionModel } from '../messageModifiers/Reactions'; +import { Reactions } from '../messageModifiers/Reactions'; import { isAnnouncementGroupReady } from '../util/isAnnouncementGroupReady'; import { getProfile } from '../util/getProfile'; import { SEALED_SENDER } from '../types/SealedSender'; diff --git a/ts/models/messages.ts b/ts/models/messages.ts index 87ee76cc8..02feed8a8 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { isEmpty, isEqual, mapValues, noop, omit, union } from 'lodash'; -import { +import type { CustomError, GroupV1Update, MessageAttributesType, @@ -17,13 +17,13 @@ import { isNormalNumber } from '../util/isNormalNumber'; import { strictAssert } from '../util/assert'; import { missingCaseError } from '../util/missingCaseError'; import { dropNull } from '../util/dropNull'; -import { ConversationModel } from './conversations'; -import { +import type { ConversationModel } from './conversations'; +import type { OwnProps as SmartMessageDetailPropsType, Contact as SmartMessageDetailContact, } from '../state/smart/MessageDetail'; import { getCallingNotificationText } from '../util/callingNotification'; -import { +import type { ProcessedDataMessage, ProcessedQuote, ProcessedUnidentifiedDeliveryStatus, @@ -32,7 +32,7 @@ import { import { SendMessageProtoError } from '../textsecure/Errors'; import * as expirationTimer from '../util/expirationTimer'; -import { ReactionType } from '../types/Reactions'; +import type { ReactionType } from '../types/Reactions'; import { copyStickerToAttachments, deletePackReference, @@ -42,14 +42,15 @@ import { import * as Stickers from '../types/Stickers'; import * as Errors from '../types/errors'; import * as EmbeddedContact from '../types/EmbeddedContact'; -import { AttachmentType, isImage, isVideo } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; +import { isImage, isVideo } from '../types/Attachment'; import * as Attachment from '../types/Attachment'; import { stringToMIMEType } from '../types/MIME'; import * as MIME from '../types/MIME'; import { ReadStatus } from '../messages/MessageReadStatus'; +import type { SendStateByConversationId } from '../messages/MessageSendState'; import { SendActionType, - SendStateByConversationId, SendStatus, isMessageJustForMe, isSent, @@ -107,7 +108,8 @@ import { MessageReceiptType, } from '../messageModifiers/MessageReceipts'; import { Deletes } from '../messageModifiers/Deletes'; -import { Reactions, ReactionModel } from '../messageModifiers/Reactions'; +import type { ReactionModel } from '../messageModifiers/Reactions'; +import { Reactions } from '../messageModifiers/Reactions'; import { ReadSyncs } from '../messageModifiers/ReadSyncs'; import { ViewSyncs } from '../messageModifiers/ViewSyncs'; import { ViewOnceOpenSyncs } from '../messageModifiers/ViewOnceOpenSyncs'; diff --git a/ts/quill/emoji/blot.tsx b/ts/quill/emoji/blot.tsx index 859e58a5a..8d70b4277 100644 --- a/ts/quill/emoji/blot.tsx +++ b/ts/quill/emoji/blot.tsx @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import Parchment from 'parchment'; +import type Parchment from 'parchment'; import Quill from 'quill'; import { emojiToImage } from '../../components/emoji/lib'; diff --git a/ts/quill/emoji/completion.tsx b/ts/quill/emoji/completion.tsx index 697a8f5f8..e284428ec 100644 --- a/ts/quill/emoji/completion.tsx +++ b/ts/quill/emoji/completion.tsx @@ -9,15 +9,15 @@ import _ from 'lodash'; import { Popper } from 'react-popper'; import classNames from 'classnames'; import { createPortal } from 'react-dom'; +import type { EmojiData } from '../../components/emoji/lib'; import { - EmojiData, search, convertShortName, isShortName, convertShortNameToData, } from '../../components/emoji/lib'; import { Emoji } from '../../components/emoji/Emoji'; -import { EmojiPickDataType } from '../../components/emoji/EmojiPicker'; +import type { EmojiPickDataType } from '../../components/emoji/EmojiPicker'; import { getBlotTextPartitions, matchBlotTextPartitions } from '../util'; import { sameWidthModifier } from '../../util/popperUtil'; diff --git a/ts/quill/memberRepository.ts b/ts/quill/memberRepository.ts index 13c49a925..1143e7de1 100644 --- a/ts/quill/memberRepository.ts +++ b/ts/quill/memberRepository.ts @@ -3,7 +3,7 @@ import Fuse from 'fuse.js'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { getOwn } from '../util/getOwn'; import { filter, map } from '../util/iterables'; diff --git a/ts/quill/mentions/blot.tsx b/ts/quill/mentions/blot.tsx index f10ee8c02..3a3b8ffc4 100644 --- a/ts/quill/mentions/blot.tsx +++ b/ts/quill/mentions/blot.tsx @@ -8,7 +8,7 @@ import Parchment from 'parchment'; import Quill from 'quill'; import { render } from 'react-dom'; import { Emojify } from '../../components/conversation/Emojify'; -import { MentionBlotValue } from '../util'; +import type { MentionBlotValue } from '../util'; declare class QuillEmbed extends Parchment.Embed { contentNode: HTMLElement; diff --git a/ts/quill/mentions/completion.tsx b/ts/quill/mentions/completion.tsx index 09e4bf6b8..5029edc0b 100644 --- a/ts/quill/mentions/completion.tsx +++ b/ts/quill/mentions/completion.tsx @@ -2,17 +2,18 @@ // SPDX-License-Identifier: AGPL-3.0-only import _ from 'lodash'; -import Quill from 'quill'; +import type Quill from 'quill'; import Delta from 'quill-delta'; -import React, { RefObject } from 'react'; +import type { RefObject } from 'react'; +import React from 'react'; import { Popper } from 'react-popper'; import classNames from 'classnames'; import { createPortal } from 'react-dom'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import { Avatar } from '../../components/Avatar'; -import { LocalizerType } from '../../types/Util'; -import { MemberRepository } from '../memberRepository'; +import type { LocalizerType } from '../../types/Util'; +import type { MemberRepository } from '../memberRepository'; import { matchBlotTextPartitions } from '../util'; import { sameWidthModifier } from '../../util/popperUtil'; diff --git a/ts/quill/mentions/matchers.ts b/ts/quill/mentions/matchers.ts index 2c52db7b5..f17bc2ed7 100644 --- a/ts/quill/mentions/matchers.ts +++ b/ts/quill/mentions/matchers.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import Delta from 'quill-delta'; -import { RefObject } from 'react'; -import { MemberRepository } from '../memberRepository'; +import type { RefObject } from 'react'; +import type { MemberRepository } from '../memberRepository'; export const matchMention = ( memberRepositoryRef: RefObject diff --git a/ts/quill/signal-clipboard/index.ts b/ts/quill/signal-clipboard/index.ts index f7f784931..44ba238b6 100644 --- a/ts/quill/signal-clipboard/index.ts +++ b/ts/quill/signal-clipboard/index.ts @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import Quill from 'quill'; +import type Quill from 'quill'; import Delta from 'quill-delta'; import { getTextFromOps } from '../util'; diff --git a/ts/quill/util.ts b/ts/quill/util.ts index 7fab42e8c..44e2b1a29 100644 --- a/ts/quill/util.ts +++ b/ts/quill/util.ts @@ -3,11 +3,11 @@ import emojiRegex from 'emoji-regex'; import Delta from 'quill-delta'; -import { LeafBlot, DeltaOperation } from 'quill'; -import Op from 'quill-delta/dist/Op'; +import type { LeafBlot, DeltaOperation } from 'quill'; +import type Op from 'quill-delta/dist/Op'; -import { BodyRangeType } from '../types/Util'; -import { MentionBlot } from './mentions/blot'; +import type { BodyRangeType } from '../types/Util'; +import type { MentionBlot } from './mentions/blot'; export type MentionBlotValue = { uuid: string; diff --git a/ts/routineProfileRefresh.ts b/ts/routineProfileRefresh.ts index 641a794ff..2ca2553dd 100644 --- a/ts/routineProfileRefresh.ts +++ b/ts/routineProfileRefresh.ts @@ -10,8 +10,8 @@ import { missingCaseError } from './util/missingCaseError'; import { isNormalNumber } from './util/isNormalNumber'; import { take } from './util/iterables'; import { isOlderThan } from './util/timestamp'; -import { ConversationModel } from './models/conversations'; -import { StorageInterface } from './types/Storage.d'; +import type { ConversationModel } from './models/conversations'; +import type { StorageInterface } from './types/Storage.d'; // Imported this way so that sinon.sandbox can stub this properly import * as profileGetter from './util/getProfile'; diff --git a/ts/services/audioRecorder.ts b/ts/services/audioRecorder.ts index 9d399cab0..491798c0a 100644 --- a/ts/services/audioRecorder.ts +++ b/ts/services/audioRecorder.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as log from '../logging/log'; -import { WebAudioRecorderClass } from '../window.d'; +import type { WebAudioRecorderClass } from '../window.d'; export class RecorderClass { private context?: AudioContext; diff --git a/ts/services/bounce.ts b/ts/services/bounce.ts index a56d1170d..c97537761 100644 --- a/ts/services/bounce.ts +++ b/ts/services/bounce.ts @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { app, BrowserWindow, ipcMain } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { app, ipcMain } from 'electron'; let bounceId = -1; diff --git a/ts/services/calling.ts b/ts/services/calling.ts index f686d6441..f2432ed91 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -4,53 +4,57 @@ /* eslint-disable class-methods-use-this */ import { desktopCapturer, ipcRenderer } from 'electron'; -import { +import type { AudioDevice, - Call, - CallEndedReason, CallId, - CallingMessage, - CallLogLevel, CallMessageUrgency, CallSettings, + DeviceId, + PeekInfo, + UserId, + VideoFrameSource, + VideoRequest, +} from 'ringrtc'; +import { + Call, + CallEndedReason, + CallingMessage, + CallLogLevel, CallState, CanvasVideoRenderer, ConnectionState, JoinState, HttpMethod, - DeviceId, GroupCall, GroupMemberInfo, GumVideoCapturer, HangupMessage, HangupType, OpaqueMessage, - PeekInfo, RingCancelReason, RingRTC, RingUpdate, - UserId, - VideoFrameSource, - VideoRequest, BandwidthMode, } from 'ringrtc'; import { uniqBy, noop } from 'lodash'; -import { +import type { ActionsType as UxActionsType, GroupCallPeekInfoType, } from '../state/ducks/calling'; import { getConversationCallMode } from '../state/ducks/conversations'; import { isConversationTooBigToRing } from '../conversations/isConversationTooBigToRing'; import { isMe } from '../util/whatTypeOfConversation'; -import { +import type { AvailableIODevicesType, - CallMode, - GroupCallConnectionState, - GroupCallJoinState, MediaDeviceSettings, PresentableSource, PresentedSource, +} from '../types/Calling'; +import { + CallMode, + GroupCallConnectionState, + GroupCallJoinState, ProcessGroupCallRingRequestResult, } from '../types/Calling'; import { @@ -61,10 +65,10 @@ import { findBestMatchingAudioDeviceIndex, findBestMatchingCameraId, } from '../calling/findBestMatchingDevice'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { UUID } from '../types/UUID'; import * as OS from '../OS'; -import { ConversationModel } from '../models/conversations'; +import type { ConversationModel } from '../models/conversations'; import * as Bytes from '../Bytes'; import { uuidToBytes, bytesToUuid } from '../Crypto'; import { dropNull, shallowDropNull } from '../util/dropNull'; @@ -78,7 +82,7 @@ import { getMembershipList, wrapWithSyncMessageSend, } from '../groups'; -import { ProcessedEnvelope } from '../textsecure/Types.d'; +import type { ProcessedEnvelope } from '../textsecure/Types.d'; import { missingCaseError } from '../util/missingCaseError'; import { normalizeGroupCallTimestamp } from '../util/ringrtc/normalizeGroupCallTimestamp'; import { diff --git a/ts/services/groupCredentialFetcher.ts b/ts/services/groupCredentialFetcher.ts index 1312298f4..43a444227 100644 --- a/ts/services/groupCredentialFetcher.ts +++ b/ts/services/groupCredentialFetcher.ts @@ -10,7 +10,7 @@ import { getClientZkAuthOperations, } from '../util/zkgroup'; -import { GroupCredentialType } from '../textsecure/WebAPI'; +import type { GroupCredentialType } from '../textsecure/WebAPI'; import * as durations from '../util/durations'; import { BackOff } from '../util/BackOff'; import { sleep } from '../util/sleep'; diff --git a/ts/services/networkObserver.ts b/ts/services/networkObserver.ts index b6023df19..acaa4cf73 100644 --- a/ts/services/networkObserver.ts +++ b/ts/services/networkObserver.ts @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { +import type { CheckNetworkStatusPayloadType, NetworkActionType, } from '../state/ducks/network'; diff --git a/ts/services/ourProfileKey.ts b/ts/services/ourProfileKey.ts index f2eebd81d..3fa732e83 100644 --- a/ts/services/ourProfileKey.ts +++ b/ts/services/ourProfileKey.ts @@ -4,7 +4,7 @@ import { assert } from '../util/assert'; import * as log from '../logging/log'; -import { StorageInterface } from '../types/Storage.d'; +import type { StorageInterface } from '../types/Storage.d'; export class OurProfileKeyService { private getPromise: undefined | Promise; diff --git a/ts/services/senderCertificate.ts b/ts/services/senderCertificate.ts index a1dc1e96f..c0c625b61 100644 --- a/ts/services/senderCertificate.ts +++ b/ts/services/senderCertificate.ts @@ -1,10 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { SerializedCertificateType } from '../textsecure/OutgoingMessage'; import { SenderCertificateMode, serializedCertificateSchema, - SerializedCertificateType, } from '../textsecure/OutgoingMessage'; import * as Bytes from '../Bytes'; import { assert } from '../util/assert'; @@ -12,7 +12,7 @@ import { missingCaseError } from '../util/missingCaseError'; import { normalizeNumber } from '../util/normalizeNumber'; import { waitForOnline } from '../util/waitForOnline'; import * as log from '../logging/log'; -import { StorageInterface } from '../types/Storage.d'; +import type { StorageInterface } from '../types/Storage.d'; import type { WebAPIType } from '../textsecure/WebAPI'; import { SignalService as Proto } from '../protobuf'; diff --git a/ts/services/storage.ts b/ts/services/storage.ts index a9fe7a2e0..3cf3a4750 100644 --- a/ts/services/storage.ts +++ b/ts/services/storage.ts @@ -23,7 +23,7 @@ import { toGroupV1Record, toGroupV2Record, } from './storageRecordOps'; -import { ConversationModel } from '../models/conversations'; +import type { ConversationModel } from '../models/conversations'; import { strictAssert } from '../util/assert'; import * as durations from '../util/durations'; import { BackOff } from '../util/BackOff'; diff --git a/ts/services/storageRecordOps.ts b/ts/services/storageRecordOps.ts index cdc5f3a1c..d37a5e5c9 100644 --- a/ts/services/storageRecordOps.ts +++ b/ts/services/storageRecordOps.ts @@ -24,7 +24,7 @@ import { parsePhoneNumberDiscoverability, } from '../util/phoneNumberDiscoverability'; import { arePinnedConversationsEqual } from '../util/arePinnedConversationsEqual'; -import { ConversationModel } from '../models/conversations'; +import type { ConversationModel } from '../models/conversations'; import { getSafeLongFromTimestamp, getTimestampFromLong, diff --git a/ts/services/updateListener.ts b/ts/services/updateListener.ts index 3b2ddf63c..8536361d3 100644 --- a/ts/services/updateListener.ts +++ b/ts/services/updateListener.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { ipcRenderer } from 'electron'; -import { DialogType } from '../types/Dialogs'; -import { +import type { DialogType } from '../types/Dialogs'; +import type { UpdateDialogOptionsType, ShowUpdateDialogAction, } from '../state/ducks/updates'; diff --git a/ts/services/writeProfile.ts b/ts/services/writeProfile.ts index 1a34042b2..ec5abe0b3 100644 --- a/ts/services/writeProfile.ts +++ b/ts/services/writeProfile.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import dataInterface from '../sql/Client'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { computeHash } from '../Crypto'; import { encryptProfileData } from '../util/encryptProfileData'; import { getProfile } from '../util/getProfile'; diff --git a/ts/shims/dispatchItemsMiddleware.ts b/ts/shims/dispatchItemsMiddleware.ts index e65b99f51..26c0cf897 100644 --- a/ts/shims/dispatchItemsMiddleware.ts +++ b/ts/shims/dispatchItemsMiddleware.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { ipcRenderer } from 'electron'; -import { Middleware } from 'redux'; +import type { Middleware } from 'redux'; import { COLORS_CHANGED, COLOR_SELECTED } from '../state/ducks/conversations'; diff --git a/ts/shims/getUserTheme.ts b/ts/shims/getUserTheme.ts index 9c172df74..c2b05409f 100644 --- a/ts/shims/getUserTheme.ts +++ b/ts/shims/getUserTheme.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ThemeType } from '../types/Util'; +import type { ThemeType } from '../types/Util'; import { getTheme } from '../state/selectors/user'; export function getUserTheme(): ThemeType { diff --git a/ts/shims/showSafetyNumberChangeDialog.tsx b/ts/shims/showSafetyNumberChangeDialog.tsx index c2dbfbca3..21c434419 100644 --- a/ts/shims/showSafetyNumberChangeDialog.tsx +++ b/ts/shims/showSafetyNumberChangeDialog.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { unmountComponentAtNode, render } from 'react-dom'; -import { ConversationModel } from '../models/conversations'; +import type { ConversationModel } from '../models/conversations'; import { SafetyNumberChangeDialog } from '../components/SafetyNumberChangeDialog'; export type SafetyNumberChangeViewProps = { diff --git a/ts/shims/socketStatus.ts b/ts/shims/socketStatus.ts index 55bb23dcc..2a3e13247 100644 --- a/ts/shims/socketStatus.ts +++ b/ts/shims/socketStatus.ts @@ -1,7 +1,7 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { SocketStatus } from '../types/SocketStatus'; +import type { SocketStatus } from '../types/SocketStatus'; export function getSocketStatus(): SocketStatus { const { getSocketStatus: getMessageReceiverStatus } = window; diff --git a/ts/shims/storage.ts b/ts/shims/storage.ts index cf575b6fe..8ea8736ba 100644 --- a/ts/shims/storage.ts +++ b/ts/shims/storage.ts @@ -1,7 +1,7 @@ // Copyright 2019-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { StorageAccessType } from '../types/Storage.d'; +import type { StorageAccessType } from '../types/Storage.d'; // Matching window.storage.put API export function put( diff --git a/ts/sql/Client.ts b/ts/sql/Client.ts index a0227ab82..70d4c5ea0 100644 --- a/ts/sql/Client.ts +++ b/ts/sql/Client.ts @@ -31,21 +31,21 @@ import { CURRENT_SCHEMA_VERSION } from '../../js/modules/types/message'; import { createBatcher } from '../util/batcher'; import { assert, strictAssert } from '../util/assert'; import { cleanDataForIpc } from './cleanDataForIpc'; -import { ReactionType } from '../types/Reactions'; -import { ConversationColorType, CustomColorType } from '../types/Colors'; +import type { ReactionType } from '../types/Reactions'; +import type { ConversationColorType, CustomColorType } from '../types/Colors'; import type { ProcessGroupCallRingRequestResult } from '../types/Calling'; import type { RemoveAllConfiguration } from '../types/RemoveAllConfiguration'; import createTaskWithTimeout from '../textsecure/TaskWithTimeout'; import * as log from '../logging/log'; -import { +import type { ConversationModelCollectionType, MessageModelCollectionType, } from '../model-types.d'; -import { StoredJob } from '../jobs/types'; +import type { StoredJob } from '../jobs/types'; import { formatJobForInsert } from '../jobs/formatJobForInsert'; -import { +import type { AttachmentDownloadJobType, ClientInterface, ClientJobType, @@ -83,8 +83,8 @@ import { } from './Interface'; import Server from './Server'; import { isCorruptionError } from './errors'; -import { MessageModel } from '../models/messages'; -import { ConversationModel } from '../models/conversations'; +import type { MessageModel } from '../models/messages'; +import type { ConversationModel } from '../models/conversations'; // We listen to a lot of events on ipc, often on the same channel. This prevents // any warnings that might be sent to the console in that case. diff --git a/ts/sql/Interface.ts b/ts/sql/Interface.ts index a39d8592c..c7674e4b9 100644 --- a/ts/sql/Interface.ts +++ b/ts/sql/Interface.ts @@ -16,9 +16,9 @@ import type { StoredJob } from '../jobs/types'; import type { ReactionType } from '../types/Reactions'; import type { ConversationColorType, CustomColorType } from '../types/Colors'; import type { ProcessGroupCallRingRequestResult } from '../types/Calling'; -import { StorageAccessType } from '../types/Storage.d'; +import type { StorageAccessType } from '../types/Storage.d'; import type { AttachmentType } from '../types/Attachment'; -import { BodyRangesType } from '../types/Util'; +import type { BodyRangesType } from '../types/Util'; import type { QualifiedAddressStringType } from '../types/QualifiedAddress'; import type { UUIDStringType } from '../types/UUID'; import type { RemoveAllConfiguration } from '../types/RemoveAllConfiguration'; diff --git a/ts/sql/Server.ts b/ts/sql/Server.ts index 06842fe76..4fe9e6f8b 100644 --- a/ts/sql/Server.ts +++ b/ts/sql/Server.ts @@ -9,12 +9,13 @@ import { join } from 'path'; import mkdirp from 'mkdirp'; import rimraf from 'rimraf'; -import SQL, { Database, Statement } from 'better-sqlite3'; +import type { Database, Statement } from 'better-sqlite3'; +import SQL from 'better-sqlite3'; import pProps from 'p-props'; import { v4 as generateUUID } from 'uuid'; +import type { Dictionary } from 'lodash'; import { - Dictionary, forEach, fromPairs, isNil, @@ -30,10 +31,10 @@ import { import { ReadStatus } from '../messages/MessageReadStatus'; import Helpers from '../textsecure/Helpers'; -import { GroupV2MemberType } from '../model-types.d'; -import { ReactionType } from '../types/Reactions'; +import type { GroupV2MemberType } from '../model-types.d'; +import type { ReactionType } from '../types/Reactions'; import { STORAGE_UI_KEYS } from '../types/StorageUIKeys'; -import { StoredJob } from '../jobs/types'; +import type { StoredJob } from '../jobs/types'; import { assert } from '../util/assert'; import { combineNames } from '../util/combineNames'; import { consoleLogger } from '../util/consoleLogger'; @@ -45,13 +46,13 @@ import { isValidGuid } from '../util/isValidGuid'; import { parseIntOrThrow } from '../util/parseIntOrThrow'; import * as durations from '../util/durations'; import { formatCountForLogging } from '../logging/formatCountForLogging'; -import { ConversationColorType, CustomColorType } from '../types/Colors'; +import type { ConversationColorType, CustomColorType } from '../types/Colors'; import { ProcessGroupCallRingRequestResult } from '../types/Calling'; import { RemoveAllConfiguration } from '../types/RemoveAllConfiguration'; import type { LoggerType } from '../types/Logging'; import * as log from '../logging/log'; -import { +import type { AllItemsType, AttachmentDownloadJobType, ConversationMetricsType, diff --git a/ts/state/actions.ts b/ts/state/actions.ts index bda9ebfa5..c7cda081c 100644 --- a/ts/state/actions.ts +++ b/ts/state/actions.ts @@ -19,7 +19,7 @@ import { actions as search } from './ducks/search'; import { actions as stickers } from './ducks/stickers'; import { actions as updates } from './ducks/updates'; import { actions as user } from './ducks/user'; -import { ReduxActions } from './types'; +import type { ReduxActions } from './types'; export const actionCreators: ReduxActions = { accounts, diff --git a/ts/state/createStore.ts b/ts/state/createStore.ts index c348a6427..e69278f63 100644 --- a/ts/state/createStore.ts +++ b/ts/state/createStore.ts @@ -3,18 +3,15 @@ /* eslint-disable no-console */ -import { - applyMiddleware, - createStore as reduxCreateStore, - DeepPartial, - Store, -} from 'redux'; +import type { DeepPartial, Store } from 'redux'; +import { applyMiddleware, createStore as reduxCreateStore } from 'redux'; import promise from 'redux-promise-middleware'; import thunk from 'redux-thunk'; import { createLogger } from 'redux-logger'; -import { reducer, StateType } from './reducer'; +import type { StateType } from './reducer'; +import { reducer } from './reducer'; import { dispatchItemsMiddleware } from '../shims/dispatchItemsMiddleware'; declare global { diff --git a/ts/state/ducks/accounts.ts b/ts/state/ducks/accounts.ts index 31cfddab1..41382450f 100644 --- a/ts/state/ducks/accounts.ts +++ b/ts/state/ducks/accounts.ts @@ -1,10 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ThunkAction } from 'redux-thunk'; -import { StateType as RootStateType } from '../reducer'; +import type { ThunkAction } from 'redux-thunk'; +import type { StateType as RootStateType } from '../reducer'; -import { NoopActionType } from './noop'; +import type { NoopActionType } from './noop'; // State diff --git a/ts/state/ducks/app.ts b/ts/state/ducks/app.ts index d725fc7b2..20ea03496 100644 --- a/ts/state/ducks/app.ts +++ b/ts/state/ducks/app.ts @@ -1,8 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ThunkAction } from 'redux-thunk'; -import { StateType as RootStateType } from '../reducer'; +import type { ThunkAction } from 'redux-thunk'; +import type { StateType as RootStateType } from '../reducer'; import * as log from '../../logging/log'; // State diff --git a/ts/state/ducks/audioPlayer.ts b/ts/state/ducks/audioPlayer.ts index 99d7ceee6..7b051724c 100644 --- a/ts/state/ducks/audioPlayer.ts +++ b/ts/state/ducks/audioPlayer.ts @@ -3,7 +3,7 @@ import { useBoundActions } from '../../hooks/useBoundActions'; -import { +import type { SwitchToAssociatedViewActionType, MessageDeletedActionType, MessageChangedActionType, diff --git a/ts/state/ducks/audioRecorder.ts b/ts/state/ducks/audioRecorder.ts index 71cac4ff6..8c8c47e32 100644 --- a/ts/state/ducks/audioRecorder.ts +++ b/ts/state/ducks/audioRecorder.ts @@ -1,12 +1,12 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ThunkAction } from 'redux-thunk'; +import type { ThunkAction } from 'redux-thunk'; import * as log from '../../logging/log'; -import { AttachmentType } from '../../types/Attachment'; +import type { AttachmentType } from '../../types/Attachment'; import { SignalService as Proto } from '../../protobuf'; -import { StateType as RootStateType } from '../reducer'; +import type { StateType as RootStateType } from '../reducer'; import { fileToBytes } from '../../util/fileToBytes'; import { recorder } from '../../services/audioRecorder'; import { stringToMIMEType } from '../../types/MIME'; diff --git a/ts/state/ducks/calling.ts b/ts/state/ducks/calling.ts index 2d38daf9d..b3e919107 100644 --- a/ts/state/ducks/calling.ts +++ b/ts/state/ducks/calling.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { ipcRenderer } from 'electron'; -import { ThunkAction } from 'redux-thunk'; +import type { ThunkAction } from 'redux-thunk'; import { CallEndedReason } from 'ringrtc'; import { hasScreenCapturePermission, @@ -15,19 +15,21 @@ import { getPlatform } from '../selectors/user'; import { isConversationTooBigToRing } from '../../conversations/isConversationTooBigToRing'; import { missingCaseError } from '../../util/missingCaseError'; import { calling } from '../../services/calling'; -import { StateType as RootStateType } from '../reducer'; -import { - CallingDeviceType, - CallMode, - CallState, +import type { StateType as RootStateType } from '../reducer'; +import type { ChangeIODevicePayloadType, - GroupCallConnectionState, - GroupCallJoinState, GroupCallVideoRequest, MediaDeviceSettings, PresentedSource, PresentableSource, } from '../../types/Calling'; +import { + CallingDeviceType, + CallMode, + CallState, + GroupCallConnectionState, + GroupCallJoinState, +} from '../../types/Calling'; import { callingTones } from '../../util/callingTones'; import { requestCameraPermissions } from '../../util/callingPermissions'; import { isGroupCallOutboundRingEnabled } from '../../util/isGroupCallOutboundRingEnabled'; diff --git a/ts/state/ducks/composer.ts b/ts/state/ducks/composer.ts index af740b780..d90b19728 100644 --- a/ts/state/ducks/composer.ts +++ b/ts/state/ducks/composer.ts @@ -1,26 +1,22 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ThunkAction } from 'redux-thunk'; +import type { ThunkAction } from 'redux-thunk'; import * as log from '../../logging/log'; -import { NoopActionType } from './noop'; -import { StateType as RootStateType } from '../reducer'; -import { AttachmentType } from '../../types/Attachment'; -import { MessageAttributesType } from '../../model-types.d'; -import { LinkPreviewWithDomain } from '../../types/LinkPreview'; +import type { NoopActionType } from './noop'; +import type { StateType as RootStateType } from '../reducer'; +import type { AttachmentType } from '../../types/Attachment'; +import type { MessageAttributesType } from '../../model-types.d'; +import type { LinkPreviewWithDomain } from '../../types/LinkPreview'; import { assignWithNoUnnecessaryAllocation } from '../../util/assignWithNoUnnecessaryAllocation'; -import { - REMOVE_PREVIEW as REMOVE_LINK_PREVIEW, - RemoveLinkPreviewActionType, -} from './linkPreviews'; +import type { RemoveLinkPreviewActionType } from './linkPreviews'; +import { REMOVE_PREVIEW as REMOVE_LINK_PREVIEW } from './linkPreviews'; import { writeDraftAttachment } from '../../util/writeDraftAttachment'; import { replaceIndex } from '../../util/replaceIndex'; import { resolveAttachmentOnDisk } from '../../util/resolveAttachmentOnDisk'; -import { - handleAttachmentsProcessing, - HandleAttachmentsProcessingArgsType, -} from '../../util/handleAttachmentsProcessing'; +import type { HandleAttachmentsProcessingArgsType } from '../../util/handleAttachmentsProcessing'; +import { handleAttachmentsProcessing } from '../../util/handleAttachmentsProcessing'; // State diff --git a/ts/state/ducks/conversations.ts b/ts/state/ducks/conversations.ts index d040856fb..79000478a 100644 --- a/ts/state/ducks/conversations.ts +++ b/ts/state/ducks/conversations.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable camelcase */ -import { ThunkAction } from 'redux-thunk'; +import type { ThunkAction } from 'redux-thunk'; import { difference, fromPairs, @@ -15,7 +15,7 @@ import { without, } from 'lodash'; -import { StateType as RootStateType } from '../reducer'; +import type { StateType as RootStateType } from '../reducer'; import * as groups from '../../groups'; import * as log from '../../logging/log'; import { calling } from '../../services/calling'; @@ -23,24 +23,22 @@ import { getOwn } from '../../util/getOwn'; import { assert, strictAssert } from '../../util/assert'; import * as universalExpireTimer from '../../util/universalExpireTimer'; import { trigger } from '../../shims/events'; -import { - TOGGLE_PROFILE_EDITOR_ERROR, - ToggleProfileEditorErrorActionType, -} from './globalModals'; +import type { ToggleProfileEditorErrorActionType } from './globalModals'; +import { TOGGLE_PROFILE_EDITOR_ERROR } from './globalModals'; -import { +import type { AvatarColorType, ConversationColorType, CustomColorType, } from '../../types/Colors'; -import { +import type { LastMessageStatus, ConversationAttributesType, MessageAttributesType, } from '../../model-types.d'; -import { BodyRangeType } from '../../types/Util'; +import type { BodyRangeType } from '../../types/Util'; import { CallMode } from '../../types/Calling'; -import { MediaItemType } from '../../types/MediaItem'; +import type { MediaItemType } from '../../types/MediaItem'; import { getGroupSizeRecommendedLimit, getGroupSizeHardLimit, @@ -48,19 +46,20 @@ import { import { getMessagesById } from '../../messages/getMessagesById'; import { isMessageUnread } from '../../util/isMessageUnread'; import { toggleSelectedContactForGroupAddition } from '../../groups/toggleSelectedContactForGroupAddition'; -import { GroupNameCollisionsWithIdsByTitle } from '../../util/groupMemberNameCollisions'; +import type { GroupNameCollisionsWithIdsByTitle } from '../../util/groupMemberNameCollisions'; import { ContactSpoofingType } from '../../util/contactSpoofing'; import { writeProfile } from '../../services/writeProfile'; import { getMe, getMessageIdsPendingBecauseOfVerification, } from '../selectors/conversations'; -import { AvatarDataType, getDefaultAvatars } from '../../types/Avatar'; +import type { AvatarDataType } from '../../types/Avatar'; +import { getDefaultAvatars } from '../../types/Avatar'; import { getAvatarData } from '../../util/getAvatarData'; import { isSameAvatarData } from '../../util/isSameAvatarData'; import { longRunningTaskWrapper } from '../../util/longRunningTaskWrapper'; -import { NoopActionType } from './noop'; +import type { NoopActionType } from './noop'; // State diff --git a/ts/state/ducks/emojis.ts b/ts/state/ducks/emojis.ts index 4515e2bb6..f74163815 100644 --- a/ts/state/ducks/emojis.ts +++ b/ts/state/ducks/emojis.ts @@ -2,8 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { take, uniq } from 'lodash'; -import { ThunkAction } from 'redux-thunk'; -import { EmojiPickDataType } from '../../components/emoji/EmojiPicker'; +import type { ThunkAction } from 'redux-thunk'; +import type { EmojiPickDataType } from '../../components/emoji/EmojiPicker'; import dataInterface from '../../sql/Client'; import { useBoundActions } from '../../hooks/useBoundActions'; diff --git a/ts/state/ducks/items.ts b/ts/state/ducks/items.ts index b560f75a4..e68c7e42f 100644 --- a/ts/state/ducks/items.ts +++ b/ts/state/ducks/items.ts @@ -3,19 +3,19 @@ import { omit } from 'lodash'; import { v4 as getGuid } from 'uuid'; -import { ThunkAction } from 'redux-thunk'; -import { StateType as RootStateType } from '../reducer'; +import type { ThunkAction } from 'redux-thunk'; +import type { StateType as RootStateType } from '../reducer'; import * as storageShim from '../../shims/storage'; import { useBoundActions } from '../../hooks/useBoundActions'; -import { - ConversationColors, +import type { ConversationColorType, CustomColorType, CustomColorsItemType, DefaultConversationColorType, } from '../../types/Colors'; +import { ConversationColors } from '../../types/Colors'; import { reloadSelectedConversation } from '../../shims/reloadSelectedConversation'; -import { StorageAccessType } from '../../types/Storage.d'; +import type { StorageAccessType } from '../../types/Storage.d'; import { actions as conversationActions } from './conversations'; // State diff --git a/ts/state/ducks/linkPreviews.ts b/ts/state/ducks/linkPreviews.ts index fa390c925..e63ca5c45 100644 --- a/ts/state/ducks/linkPreviews.ts +++ b/ts/state/ducks/linkPreviews.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LinkPreviewType } from '../../types/message/LinkPreviews'; +import type { LinkPreviewType } from '../../types/message/LinkPreviews'; import { assignWithNoUnnecessaryAllocation } from '../../util/assignWithNoUnnecessaryAllocation'; // State diff --git a/ts/state/ducks/safetyNumber.ts b/ts/state/ducks/safetyNumber.ts index c4d3d6215..6f8ce97d4 100644 --- a/ts/state/ducks/safetyNumber.ts +++ b/ts/state/ducks/safetyNumber.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { generateSecurityNumberBlock } from '../../util/safetyNumber'; -import { ConversationType } from './conversations'; +import type { ConversationType } from './conversations'; import { reloadProfiles, toggleVerification, diff --git a/ts/state/ducks/search.ts b/ts/state/ducks/search.ts index 8f38ee564..aa57f6b0c 100644 --- a/ts/state/ducks/search.ts +++ b/ts/state/ducks/search.ts @@ -5,14 +5,14 @@ import { omit, reject } from 'lodash'; import { normalize } from '../../types/PhoneNumber'; import { cleanSearchTerm } from '../../util/cleanSearchTerm'; -import { +import type { ClientSearchResultMessageType, ClientInterface, } from '../../sql/Interface'; import dataInterface from '../../sql/Client'; import { makeLookup } from '../../util/makeLookup'; -import { +import type { ConversationUnloadedActionType, DBConversationType, MessageDeletedActionType, diff --git a/ts/state/ducks/stickers.ts b/ts/state/ducks/stickers.ts index 6efff3280..563d7edb6 100644 --- a/ts/state/ducks/stickers.ts +++ b/ts/state/ducks/stickers.ts @@ -1,22 +1,23 @@ // Copyright 2019-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { Dictionary, omit, reject } from 'lodash'; +import type { Dictionary } from 'lodash'; +import { omit, reject } from 'lodash'; import type { StickerPackStatusType, StickerType as StickerDBType, StickerPackType as StickerPackDBType, } from '../../sql/Interface'; import dataInterface from '../../sql/Client'; +import type { RecentStickerType } from '../../types/Stickers'; import { downloadStickerPack as externalDownloadStickerPack, maybeDeletePack, - RecentStickerType, } from '../../types/Stickers'; import { sendStickerPackSync } from '../../shims/textsecure'; import { trigger } from '../../shims/events'; -import { NoopActionType } from './noop'; +import type { NoopActionType } from './noop'; const { getRecentStickers, diff --git a/ts/state/ducks/updates.ts b/ts/state/ducks/updates.ts index 416cc1c1b..6497d163b 100644 --- a/ts/state/ducks/updates.ts +++ b/ts/state/ducks/updates.ts @@ -1,11 +1,11 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ThunkAction } from 'redux-thunk'; +import type { ThunkAction } from 'redux-thunk'; import * as updateIpc from '../../shims/updateIpc'; import { DialogType } from '../../types/Dialogs'; import { DAY } from '../../util/durations'; -import { StateType as RootStateType } from '../reducer'; +import type { StateType as RootStateType } from '../reducer'; // State diff --git a/ts/state/ducks/user.ts b/ts/state/ducks/user.ts index 80177a498..c7a587ad9 100644 --- a/ts/state/ducks/user.ts +++ b/ts/state/ducks/user.ts @@ -3,8 +3,9 @@ import { trigger } from '../../shims/events'; -import { NoopActionType } from './noop'; -import { LocalizerType, ThemeType } from '../../types/Util'; +import type { NoopActionType } from './noop'; +import type { LocalizerType } from '../../types/Util'; +import { ThemeType } from '../../types/Util'; // State diff --git a/ts/state/roots/createApp.tsx b/ts/state/roots/createApp.tsx index 0f9b4f527..9df609899 100644 --- a/ts/state/roots/createApp.tsx +++ b/ts/state/roots/createApp.tsx @@ -1,10 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactElement } from 'react'; +import type { ReactElement } from 'react'; +import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { SmartApp } from '../smart/App'; import { SmartGlobalAudioProvider } from '../smart/GlobalAudioProvider'; diff --git a/ts/state/roots/createChatColorPicker.tsx b/ts/state/roots/createChatColorPicker.tsx index 4457855b4..b9dbd9188 100644 --- a/ts/state/roots/createChatColorPicker.tsx +++ b/ts/state/roots/createChatColorPicker.tsx @@ -4,12 +4,10 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { - SmartChatColorPicker, - SmartChatColorPickerProps, -} from '../smart/ChatColorPicker'; +import type { SmartChatColorPickerProps } from '../smart/ChatColorPicker'; +import { SmartChatColorPicker } from '../smart/ChatColorPicker'; export const createChatColorPicker = ( store: Store, diff --git a/ts/state/roots/createConversationDetails.tsx b/ts/state/roots/createConversationDetails.tsx index ddb5467a0..00fc89866 100644 --- a/ts/state/roots/createConversationDetails.tsx +++ b/ts/state/roots/createConversationDetails.tsx @@ -4,12 +4,10 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { - SmartConversationDetails, - SmartConversationDetailsProps, -} from '../smart/ConversationDetails'; +import type { SmartConversationDetailsProps } from '../smart/ConversationDetails'; +import { SmartConversationDetails } from '../smart/ConversationDetails'; export const createConversationDetails = ( store: Store, diff --git a/ts/state/roots/createConversationNotificationsSettings.tsx b/ts/state/roots/createConversationNotificationsSettings.tsx index 4274241f6..7a9da3a85 100644 --- a/ts/state/roots/createConversationNotificationsSettings.tsx +++ b/ts/state/roots/createConversationNotificationsSettings.tsx @@ -4,12 +4,10 @@ import * as React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { - SmartConversationNotificationsSettings, - OwnProps, -} from '../smart/ConversationNotificationsSettings'; +import type { OwnProps } from '../smart/ConversationNotificationsSettings'; +import { SmartConversationNotificationsSettings } from '../smart/ConversationNotificationsSettings'; export const createConversationNotificationsSettings = ( store: Store, diff --git a/ts/state/roots/createConversationView.tsx b/ts/state/roots/createConversationView.tsx index 6b2b70d09..f6ac2cfd5 100644 --- a/ts/state/roots/createConversationView.tsx +++ b/ts/state/roots/createConversationView.tsx @@ -4,9 +4,10 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { SmartConversationView, PropsType } from '../smart/ConversationView'; +import type { PropsType } from '../smart/ConversationView'; +import { SmartConversationView } from '../smart/ConversationView'; // Workaround: A react component's required properties are filtering up through connect() // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31363 diff --git a/ts/state/roots/createForwardMessageModal.tsx b/ts/state/roots/createForwardMessageModal.tsx index b28ffb0a0..171ba7aef 100644 --- a/ts/state/roots/createForwardMessageModal.tsx +++ b/ts/state/roots/createForwardMessageModal.tsx @@ -4,12 +4,10 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { - SmartForwardMessageModal, - SmartForwardMessageModalProps, -} from '../smart/ForwardMessageModal'; +import type { SmartForwardMessageModalProps } from '../smart/ForwardMessageModal'; +import { SmartForwardMessageModal } from '../smart/ForwardMessageModal'; export const createForwardMessageModal = ( store: Store, diff --git a/ts/state/roots/createGroupLinkManagement.tsx b/ts/state/roots/createGroupLinkManagement.tsx index 7c70750d5..a59be7e46 100644 --- a/ts/state/roots/createGroupLinkManagement.tsx +++ b/ts/state/roots/createGroupLinkManagement.tsx @@ -4,12 +4,10 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { - SmartGroupLinkManagement, - SmartGroupLinkManagementProps, -} from '../smart/GroupLinkManagement'; +import type { SmartGroupLinkManagementProps } from '../smart/GroupLinkManagement'; +import { SmartGroupLinkManagement } from '../smart/GroupLinkManagement'; export const createGroupLinkManagement = ( store: Store, diff --git a/ts/state/roots/createGroupV1MigrationModal.tsx b/ts/state/roots/createGroupV1MigrationModal.tsx index 9e3af97bd..929a2cf01 100644 --- a/ts/state/roots/createGroupV1MigrationModal.tsx +++ b/ts/state/roots/createGroupV1MigrationModal.tsx @@ -4,13 +4,11 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { ModalHost } from '../../components/ModalHost'; -import { - SmartGroupV1MigrationDialog, - PropsType, -} from '../smart/GroupV1MigrationDialog'; +import type { PropsType } from '../smart/GroupV1MigrationDialog'; +import { SmartGroupV1MigrationDialog } from '../smart/GroupV1MigrationDialog'; export const createGroupV1MigrationModal = ( store: Store, diff --git a/ts/state/roots/createGroupV2JoinModal.tsx b/ts/state/roots/createGroupV2JoinModal.tsx index 43a64389a..49a87293a 100644 --- a/ts/state/roots/createGroupV2JoinModal.tsx +++ b/ts/state/roots/createGroupV2JoinModal.tsx @@ -4,10 +4,11 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { ModalHost } from '../../components/ModalHost'; -import { SmartGroupV2JoinDialog, PropsType } from '../smart/GroupV2JoinDialog'; +import type { PropsType } from '../smart/GroupV2JoinDialog'; +import { SmartGroupV2JoinDialog } from '../smart/GroupV2JoinDialog'; export const createGroupV2JoinModal = ( store: Store, diff --git a/ts/state/roots/createGroupV2Permissions.tsx b/ts/state/roots/createGroupV2Permissions.tsx index d04bb9af5..771e71a4c 100644 --- a/ts/state/roots/createGroupV2Permissions.tsx +++ b/ts/state/roots/createGroupV2Permissions.tsx @@ -4,12 +4,10 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { - SmartGroupV2Permissions, - SmartGroupV2PermissionsProps, -} from '../smart/GroupV2Permissions'; +import type { SmartGroupV2PermissionsProps } from '../smart/GroupV2Permissions'; +import { SmartGroupV2Permissions } from '../smart/GroupV2Permissions'; export const createGroupV2Permissions = ( store: Store, diff --git a/ts/state/roots/createLeftPane.tsx b/ts/state/roots/createLeftPane.tsx index 89907701a..4398b5779 100644 --- a/ts/state/roots/createLeftPane.tsx +++ b/ts/state/roots/createLeftPane.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { SmartLeftPane } from '../smart/LeftPane'; diff --git a/ts/state/roots/createMessageDetail.tsx b/ts/state/roots/createMessageDetail.tsx index fd17c05c0..c934bee42 100644 --- a/ts/state/roots/createMessageDetail.tsx +++ b/ts/state/roots/createMessageDetail.tsx @@ -1,12 +1,14 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactElement } from 'react'; +import type { ReactElement } from 'react'; +import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { SmartMessageDetail, OwnProps } from '../smart/MessageDetail'; +import type { OwnProps } from '../smart/MessageDetail'; +import { SmartMessageDetail } from '../smart/MessageDetail'; export const createMessageDetail = ( store: Store, diff --git a/ts/state/roots/createPendingInvites.tsx b/ts/state/roots/createPendingInvites.tsx index 4bb603a69..ba7b07a9e 100644 --- a/ts/state/roots/createPendingInvites.tsx +++ b/ts/state/roots/createPendingInvites.tsx @@ -4,12 +4,10 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; -import { - SmartPendingInvites, - SmartPendingInvitesProps, -} from '../smart/PendingInvites'; +import type { SmartPendingInvitesProps } from '../smart/PendingInvites'; +import { SmartPendingInvites } from '../smart/PendingInvites'; export const createPendingInvites = ( store: Store, diff --git a/ts/state/roots/createSafetyNumberViewer.tsx b/ts/state/roots/createSafetyNumberViewer.tsx index 998f58cb2..1b1b0b8fb 100644 --- a/ts/state/roots/createSafetyNumberViewer.tsx +++ b/ts/state/roots/createSafetyNumberViewer.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { SmartSafetyNumberViewer } from '../smart/SafetyNumberViewer'; diff --git a/ts/state/roots/createShortcutGuideModal.tsx b/ts/state/roots/createShortcutGuideModal.tsx index 932d450b8..0c39ba185 100644 --- a/ts/state/roots/createShortcutGuideModal.tsx +++ b/ts/state/roots/createShortcutGuideModal.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { SmartShortcutGuideModal } from '../smart/ShortcutGuideModal'; diff --git a/ts/state/roots/createStickerManager.tsx b/ts/state/roots/createStickerManager.tsx index f461a2d33..8b85f3bf2 100644 --- a/ts/state/roots/createStickerManager.tsx +++ b/ts/state/roots/createStickerManager.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { SmartStickerManager } from '../smart/StickerManager'; diff --git a/ts/state/roots/createStickerPreviewModal.tsx b/ts/state/roots/createStickerPreviewModal.tsx index 5db9843e0..bc1a94202 100644 --- a/ts/state/roots/createStickerPreviewModal.tsx +++ b/ts/state/roots/createStickerPreviewModal.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { Provider } from 'react-redux'; -import { Store } from 'redux'; +import type { Store } from 'redux'; import { SmartStickerPreviewModal } from '../smart/StickerPreviewModal'; diff --git a/ts/state/selectors/accounts.ts b/ts/state/selectors/accounts.ts index 3204debee..45f5d71b0 100644 --- a/ts/state/selectors/accounts.ts +++ b/ts/state/selectors/accounts.ts @@ -3,8 +3,8 @@ import { createSelector } from 'reselect'; -import { StateType } from '../reducer'; -import { AccountsStateType } from '../ducks/accounts'; +import type { StateType } from '../reducer'; +import type { AccountsStateType } from '../ducks/accounts'; export const getAccounts = (state: StateType): AccountsStateType => state.accounts; diff --git a/ts/state/selectors/audioPlayer.ts b/ts/state/selectors/audioPlayer.ts index bf284e133..0d9f660ba 100644 --- a/ts/state/selectors/audioPlayer.ts +++ b/ts/state/selectors/audioPlayer.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; export const isPaused = (state: StateType): boolean => { return state.audioPlayer.activeAudioID === undefined; diff --git a/ts/state/selectors/calling.ts b/ts/state/selectors/calling.ts index b4e66c917..1b5e23c31 100644 --- a/ts/state/selectors/calling.ts +++ b/ts/state/selectors/calling.ts @@ -3,14 +3,14 @@ import { createSelector } from 'reselect'; -import { StateType } from '../reducer'; -import { +import type { StateType } from '../reducer'; +import type { CallingStateType, CallsByConversationType, DirectCallStateType, GroupCallStateType, - getIncomingCall as getIncomingCallHelper, } from '../ducks/calling'; +import { getIncomingCall as getIncomingCallHelper } from '../ducks/calling'; import { getUserUuid } from './user'; import { getOwn } from '../../util/getOwn'; diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index ea11ec40b..2c73f17a7 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -5,28 +5,28 @@ import memoizee from 'memoizee'; import { fromPairs, isNumber } from 'lodash'; import { createSelector } from 'reselect'; -import { StateType } from '../reducer'; -import { - ComposerStep, +import type { StateType } from '../reducer'; +import type { ConversationLookupType, ConversationMessageType, ConversationsStateType, ConversationType, MessageLookupType, MessagesByConversationType, - OneTimeModalState, PreJoinConversationType, } from '../ducks/conversations'; +import { ComposerStep, OneTimeModalState } from '../ducks/conversations'; import { getOwn } from '../../util/getOwn'; import { isNotNil } from '../../util/isNotNil'; import { deconstructLookup } from '../../util/deconstructLookup'; -import { PropsDataType as TimelinePropsType } from '../../components/conversation/Timeline'; -import { TimelineItemType } from '../../components/conversation/TimelineItem'; +import type { PropsDataType as TimelinePropsType } from '../../components/conversation/Timeline'; +import type { TimelineItemType } from '../../components/conversation/TimelineItem'; import { assert } from '../../util/assert'; import { isConversationUnregistered } from '../../util/isConversationUnregistered'; import { filterAndSortConversationsByTitle } from '../../util/filterAndSortConversations'; -import { ContactNameColors, ContactNameColorType } from '../../types/Colors'; -import { AvatarDataType } from '../../types/Avatar'; +import type { ContactNameColorType } from '../../types/Colors'; +import { ContactNameColors } from '../../types/Colors'; +import type { AvatarDataType } from '../../types/Avatar'; import { isInSystemContacts } from '../../util/isInSystemContacts'; import { sortByTitle } from '../../util/sortByTitle'; import { @@ -44,13 +44,10 @@ import { } from './user'; import { getPinnedConversationIds } from './items'; import { getPropsForBubble } from './message'; -import { - CallSelectorType, - CallStateType, - getActiveCall, - getCallSelector, -} from './calling'; -import { getAccountSelector, AccountSelectorType } from './accounts'; +import type { CallSelectorType, CallStateType } from './calling'; +import { getActiveCall, getCallSelector } from './calling'; +import type { AccountSelectorType } from './accounts'; +import { getAccountSelector } from './accounts'; import * as log from '../../logging/log'; let placeholderContact: ConversationType; diff --git a/ts/state/selectors/emojis.ts b/ts/state/selectors/emojis.ts index 6bca976a7..b3cac523e 100644 --- a/ts/state/selectors/emojis.ts +++ b/ts/state/selectors/emojis.ts @@ -4,7 +4,7 @@ import { createSelector } from 'reselect'; import { useSelector } from 'react-redux'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { isShortName } from '../../components/emoji/lib'; export const selectRecentEmojis = createSelector( diff --git a/ts/state/selectors/items.ts b/ts/state/selectors/items.ts index f945ca48d..3f56c54cb 100644 --- a/ts/state/selectors/items.ts +++ b/ts/state/selectors/items.ts @@ -6,13 +6,13 @@ import { isInteger } from 'lodash'; import { ITEM_NAME as UNIVERSAL_EXPIRE_TIMER_ITEM } from '../../util/universalExpireTimer'; -import { StateType } from '../reducer'; -import { ItemsStateType } from '../ducks/items'; -import { +import type { StateType } from '../reducer'; +import type { ItemsStateType } from '../ducks/items'; +import type { ConversationColorType, CustomColorType, - DEFAULT_CONVERSATION_COLOR, } from '../../types/Colors'; +import { DEFAULT_CONVERSATION_COLOR } from '../../types/Colors'; import { getPreferredReactionEmoji as getPreferredReactionEmojiFromStoredValue } from '../../reactions/preferredReactionEmoji'; const DEFAULT_PREFERRED_LEFT_PANE_WIDTH = 320; diff --git a/ts/state/selectors/linkPreviews.ts b/ts/state/selectors/linkPreviews.ts index 001a60bd5..dc4b1c093 100644 --- a/ts/state/selectors/linkPreviews.ts +++ b/ts/state/selectors/linkPreviews.ts @@ -6,7 +6,7 @@ import { createSelector } from 'reselect'; import { assert } from '../../util/assert'; import { getDomain } from '../../types/LinkPreview'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; export const getLinkPreview = createSelector( ({ linkPreviews }: StateType) => linkPreviews.linkPreview, diff --git a/ts/state/selectors/message.ts b/ts/state/selectors/message.ts index 629f7d35c..ec003d653 100644 --- a/ts/state/selectors/message.ts +++ b/ts/state/selectors/message.ts @@ -14,56 +14,55 @@ import { import { createSelectorCreator } from 'reselect'; import filesize from 'filesize'; -import { +import type { LastMessageStatus, MessageAttributesType, ShallowChallengeError, } from '../../model-types.d'; -import { TimelineItemType } from '../../components/conversation/TimelineItem'; -import { PropsData } from '../../components/conversation/Message'; -import { PropsData as TimerNotificationProps } from '../../components/conversation/TimerNotification'; -import { PropsData as ChangeNumberNotificationProps } from '../../components/conversation/ChangeNumberNotification'; -import { PropsData as SafetyNumberNotificationProps } from '../../components/conversation/SafetyNumberNotification'; -import { PropsData as VerificationNotificationProps } from '../../components/conversation/VerificationNotification'; -import { PropsDataType as GroupsV2Props } from '../../components/conversation/GroupV2Change'; -import { PropsDataType as GroupV1MigrationPropsType } from '../../components/conversation/GroupV1Migration'; -import { PropsDataType as DeliveryIssuePropsType } from '../../components/conversation/DeliveryIssueNotification'; -import { +import type { TimelineItemType } from '../../components/conversation/TimelineItem'; +import type { PropsData } from '../../components/conversation/Message'; +import type { PropsData as TimerNotificationProps } from '../../components/conversation/TimerNotification'; +import type { PropsData as ChangeNumberNotificationProps } from '../../components/conversation/ChangeNumberNotification'; +import type { PropsData as SafetyNumberNotificationProps } from '../../components/conversation/SafetyNumberNotification'; +import type { PropsData as VerificationNotificationProps } from '../../components/conversation/VerificationNotification'; +import type { PropsDataType as GroupsV2Props } from '../../components/conversation/GroupV2Change'; +import type { PropsDataType as GroupV1MigrationPropsType } from '../../components/conversation/GroupV1Migration'; +import type { PropsDataType as DeliveryIssuePropsType } from '../../components/conversation/DeliveryIssueNotification'; +import type { PropsData as GroupNotificationProps, ChangeType, } from '../../components/conversation/GroupNotification'; -import { PropsType as ProfileChangeNotificationPropsType } from '../../components/conversation/ProfileChangeNotification'; -import { QuotedAttachmentType } from '../../components/conversation/Quote'; +import type { PropsType as ProfileChangeNotificationPropsType } from '../../components/conversation/ProfileChangeNotification'; +import type { QuotedAttachmentType } from '../../components/conversation/Quote'; import { getDomain, isStickerPack } from '../../types/LinkPreview'; -import { - EmbeddedContactType, - embeddedContactSelector, -} from '../../types/EmbeddedContact'; -import { AssertProps, BodyRangesType } from '../../types/Util'; -import { LinkPreviewType } from '../../types/message/LinkPreviews'; +import type { EmbeddedContactType } from '../../types/EmbeddedContact'; +import { embeddedContactSelector } from '../../types/EmbeddedContact'; +import type { AssertProps, BodyRangesType } from '../../types/Util'; +import type { LinkPreviewType } from '../../types/message/LinkPreviews'; import { CallMode } from '../../types/Calling'; import { SignalService as Proto } from '../../protobuf'; -import { AttachmentType, isVoiceMessage } from '../../types/Attachment'; +import type { AttachmentType } from '../../types/Attachment'; +import { isVoiceMessage } from '../../types/Attachment'; import { ReadStatus } from '../../messages/MessageReadStatus'; -import { CallingNotificationType } from '../../util/callingNotification'; +import type { CallingNotificationType } from '../../util/callingNotification'; import { memoizeByRoot } from '../../util/memoizeByRoot'; import { missingCaseError } from '../../util/missingCaseError'; import { isNotNil } from '../../util/isNotNil'; import { isMoreRecentThan } from '../../util/timestamp'; -import { ConversationType } from '../ducks/conversations'; +import type { ConversationType } from '../ducks/conversations'; -import { AccountSelectorType } from './accounts'; -import { CallSelectorType, CallStateType } from './calling'; -import { +import type { AccountSelectorType } from './accounts'; +import type { CallSelectorType, CallStateType } from './calling'; +import type { GetConversationByIdType, - isMissingRequiredProfileSharing, ContactNameColorSelectorType, } from './conversations'; +import { isMissingRequiredProfileSharing } from './conversations'; import { SendStatus, isDelivered, diff --git a/ts/state/selectors/network.ts b/ts/state/selectors/network.ts index f39795408..43698e9f6 100644 --- a/ts/state/selectors/network.ts +++ b/ts/state/selectors/network.ts @@ -3,8 +3,8 @@ import { createSelector } from 'reselect'; -import { StateType } from '../reducer'; -import { NetworkStateType } from '../ducks/network'; +import type { StateType } from '../reducer'; +import type { NetworkStateType } from '../ducks/network'; import { isDone } from '../../util/registration'; import { SocketStatus } from '../../types/SocketStatus'; diff --git a/ts/state/selectors/safetyNumber.ts b/ts/state/selectors/safetyNumber.ts index c4b19284b..f10ee0898 100644 --- a/ts/state/selectors/safetyNumber.ts +++ b/ts/state/selectors/safetyNumber.ts @@ -3,8 +3,8 @@ import { createSelector } from 'reselect'; -import { StateType } from '../reducer'; -import { +import type { StateType } from '../reducer'; +import type { SafetyNumberContactType, SafetyNumberStateType, } from '../ducks/safetyNumber'; diff --git a/ts/state/selectors/search.ts b/ts/state/selectors/search.ts index 826e38141..5eec356c5 100644 --- a/ts/state/selectors/search.ts +++ b/ts/state/selectors/search.ts @@ -6,29 +6,29 @@ import { createSelector } from 'reselect'; import { deconstructLookup } from '../../util/deconstructLookup'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; -import { +import type { MessageSearchResultLookupType, MessageSearchResultType, SearchStateType, } from '../ducks/search'; -import { +import type { ConversationLookupType, ConversationType, } from '../ducks/conversations'; -import { LeftPaneSearchPropsType } from '../../components/leftPane/LeftPaneSearchHelper'; -import { PropsDataType as MessageSearchResultPropsDataType } from '../../components/conversationList/MessageSearchResult'; +import type { LeftPaneSearchPropsType } from '../../components/leftPane/LeftPaneSearchHelper'; +import type { PropsDataType as MessageSearchResultPropsDataType } from '../../components/conversationList/MessageSearchResult'; import { getUserConversationId } from './user'; +import type { GetConversationByIdType } from './conversations'; import { - GetConversationByIdType, getConversationLookup, getConversationSelector, } from './conversations'; -import { BodyRangeType } from '../../types/Util'; +import type { BodyRangeType } from '../../types/Util'; import * as log from '../../logging/log'; export const getSearch = (state: StateType): SearchStateType => state.search; diff --git a/ts/state/selectors/stickers.ts b/ts/state/selectors/stickers.ts index abd5cf96d..91445be6c 100644 --- a/ts/state/selectors/stickers.ts +++ b/ts/state/selectors/stickers.ts @@ -2,16 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { join } from 'path'; -import { - compact, - Dictionary, - filter, - map, - orderBy, - reject, - sortBy, - values, -} from 'lodash'; +import type { Dictionary } from 'lodash'; +import { compact, filter, map, orderBy, reject, sortBy, values } from 'lodash'; import { createSelector } from 'reselect'; import type { RecentStickerType } from '../../types/Stickers'; @@ -19,8 +11,8 @@ import type { StickerType as StickerDBType, StickerPackType as StickerPackDBType, } from '../../sql/Interface'; -import { StateType } from '../reducer'; -import { +import type { StateType } from '../reducer'; +import type { StickersStateType, StickerPackType, StickerType, diff --git a/ts/state/selectors/user.ts b/ts/state/selectors/user.ts index 94267a313..2ef5c60cd 100644 --- a/ts/state/selectors/user.ts +++ b/ts/state/selectors/user.ts @@ -3,10 +3,10 @@ import { createSelector } from 'reselect'; -import { LocalizerType, ThemeType } from '../../types/Util'; +import type { LocalizerType, ThemeType } from '../../types/Util'; -import { StateType } from '../reducer'; -import { UserStateType } from '../ducks/user'; +import type { StateType } from '../reducer'; +import type { UserStateType } from '../ducks/user'; export const getUser = (state: StateType): UserStateType => state.user; diff --git a/ts/state/smart/App.tsx b/ts/state/smart/App.tsx index 86a8584a2..4809f2490 100644 --- a/ts/state/smart/App.tsx +++ b/ts/state/smart/App.tsx @@ -9,7 +9,7 @@ import { SmartCallManager } from './CallManager'; import { SmartCustomizingPreferredReactionsModal } from './CustomizingPreferredReactionsModal'; import { SmartGlobalModalContainer } from './GlobalModalContainer'; import { SmartSafetyNumberViewer } from './SafetyNumberViewer'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl, getTheme } from '../selectors/user'; import { getConversationsStoppingMessageSendBecauseOfVerification, diff --git a/ts/state/smart/CallManager.tsx b/ts/state/smart/CallManager.tsx index 0f58ecd95..cbd426473 100644 --- a/ts/state/smart/CallManager.tsx +++ b/ts/state/smart/CallManager.tsx @@ -10,22 +10,19 @@ import { calling as callingService } from '../../services/calling'; import { getUserUuid, getIntl } from '../selectors/user'; import { getMe, getConversationSelector } from '../selectors/conversations'; import { getActiveCall } from '../ducks/calling'; -import { ConversationType } from '../ducks/conversations'; +import type { ConversationType } from '../ducks/conversations'; import { getIncomingCall } from '../selectors/calling'; import { isGroupCallOutboundRingEnabled } from '../../util/isGroupCallOutboundRingEnabled'; -import { +import type { ActiveCallType, - CallMode, - CallState, GroupCallRemoteParticipantType, } from '../../types/Calling'; -import { StateType } from '../reducer'; +import { CallMode, CallState } from '../../types/Calling'; +import type { StateType } from '../reducer'; import { missingCaseError } from '../../util/missingCaseError'; import { SmartCallingDeviceSelection } from './CallingDeviceSelection'; -import { - SmartSafetyNumberViewer, - Props as SafetyNumberViewerProps, -} from './SafetyNumberViewer'; +import type { Props as SafetyNumberViewerProps } from './SafetyNumberViewer'; +import { SmartSafetyNumberViewer } from './SafetyNumberViewer'; import { callingTones } from '../../util/callingTones'; import { bounceAppIconStart, diff --git a/ts/state/smart/CallingDeviceSelection.tsx b/ts/state/smart/CallingDeviceSelection.tsx index fa32de7b8..17e001086 100644 --- a/ts/state/smart/CallingDeviceSelection.tsx +++ b/ts/state/smart/CallingDeviceSelection.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { CallingDeviceSelection } from '../../components/CallingDeviceSelection'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; diff --git a/ts/state/smart/CaptchaDialog.tsx b/ts/state/smart/CaptchaDialog.tsx index d1972b246..341b757a3 100644 --- a/ts/state/smart/CaptchaDialog.tsx +++ b/ts/state/smart/CaptchaDialog.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { CaptchaDialog } from '../../components/CaptchaDialog'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { isChallengePending } from '../selectors/network'; import { getChallengeURL } from '../../challenge'; diff --git a/ts/state/smart/ChatColorPicker.tsx b/ts/state/smart/ChatColorPicker.tsx index b42641941..776c8b5e6 100644 --- a/ts/state/smart/ChatColorPicker.tsx +++ b/ts/state/smart/ChatColorPicker.tsx @@ -4,11 +4,9 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - ChatColorPicker, - PropsDataType, -} from '../../components/ChatColorPicker'; -import { StateType } from '../reducer'; +import type { PropsDataType } from '../../components/ChatColorPicker'; +import { ChatColorPicker } from '../../components/ChatColorPicker'; +import type { StateType } from '../reducer'; import { getConversationSelector, getConversationsWithCustomColorSelector, diff --git a/ts/state/smart/CompositionArea.tsx b/ts/state/smart/CompositionArea.tsx index 311797690..bab5a3e17 100644 --- a/ts/state/smart/CompositionArea.tsx +++ b/ts/state/smart/CompositionArea.tsx @@ -4,11 +4,9 @@ import { connect } from 'react-redux'; import { get } from 'lodash'; import { mapDispatchToProps } from '../actions'; -import { - CompositionArea, - Props as ComponentPropsType, -} from '../../components/CompositionArea'; -import { StateType } from '../reducer'; +import type { Props as ComponentPropsType } from '../../components/CompositionArea'; +import { CompositionArea } from '../../components/CompositionArea'; +import type { StateType } from '../reducer'; import { isConversationSMSOnly } from '../../util/isConversationSMSOnly'; import { dropNull } from '../../util/dropNull'; diff --git a/ts/state/smart/ContactModal.tsx b/ts/state/smart/ContactModal.tsx index 97fcbfd11..222a7319f 100644 --- a/ts/state/smart/ContactModal.tsx +++ b/ts/state/smart/ContactModal.tsx @@ -3,11 +3,9 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - ContactModal, - PropsDataType, -} from '../../components/conversation/ContactModal'; -import { StateType } from '../reducer'; +import type { PropsDataType } from '../../components/conversation/ContactModal'; +import { ContactModal } from '../../components/conversation/ContactModal'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getConversationSelector } from '../selectors/conversations'; diff --git a/ts/state/smart/ContactName.tsx b/ts/state/smart/ContactName.tsx index 275b43ba1..f34549219 100644 --- a/ts/state/smart/ContactName.tsx +++ b/ts/state/smart/ContactName.tsx @@ -3,17 +3,15 @@ import * as React from 'react'; import { useSelector } from 'react-redux'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { ContactName } from '../../components/conversation/ContactName'; import { getIntl } from '../selectors/user'; -import { - GetConversationByIdType, - getConversationSelector, -} from '../selectors/conversations'; +import type { GetConversationByIdType } from '../selectors/conversations'; +import { getConversationSelector } from '../selectors/conversations'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; type ExternalProps = { conversationId: string; diff --git a/ts/state/smart/ConversationDetails.tsx b/ts/state/smart/ConversationDetails.tsx index 08eaaa002..0c9c0389b 100644 --- a/ts/state/smart/ConversationDetails.tsx +++ b/ts/state/smart/ConversationDetails.tsx @@ -3,19 +3,17 @@ import { connect } from 'react-redux'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { mapDispatchToProps } from '../actions'; -import { - ConversationDetails, - StateProps, -} from '../../components/conversation/conversation-details/ConversationDetails'; +import type { StateProps } from '../../components/conversation/conversation-details/ConversationDetails'; +import { ConversationDetails } from '../../components/conversation/conversation-details/ConversationDetails'; import { getCandidateContactsForNewGroup, getConversationByIdSelector, } from '../selectors/conversations'; import { getGroupMemberships } from '../../util/getGroupMemberships'; import { getIntl } from '../selectors/user'; -import { MediaItemType } from '../../types/MediaItem'; +import type { MediaItemType } from '../../types/MediaItem'; import { assert } from '../../util/assert'; import { SignalService as Proto } from '../../protobuf'; diff --git a/ts/state/smart/ConversationHeader.tsx b/ts/state/smart/ConversationHeader.tsx index e7ba569ae..14746eaed 100644 --- a/ts/state/smart/ConversationHeader.tsx +++ b/ts/state/smart/ConversationHeader.tsx @@ -11,12 +11,10 @@ import { getConversationSelector, isMissingRequiredProfileSharing, } from '../selectors/conversations'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { CallMode } from '../../types/Calling'; -import { - ConversationType, - getConversationCallMode, -} from '../ducks/conversations'; +import type { ConversationType } from '../ducks/conversations'; +import { getConversationCallMode } from '../ducks/conversations'; import { getActiveCall, isAnybodyElseInGroupCall } from '../ducks/calling'; import { getUserUuid, getIntl } from '../selectors/user'; import { getOwn } from '../../util/getOwn'; diff --git a/ts/state/smart/ConversationNotificationsSettings.tsx b/ts/state/smart/ConversationNotificationsSettings.tsx index d29adf38e..6eb7a3164 100644 --- a/ts/state/smart/ConversationNotificationsSettings.tsx +++ b/ts/state/smart/ConversationNotificationsSettings.tsx @@ -3,7 +3,7 @@ import { connect } from 'react-redux'; import { ConversationNotificationsSettings } from '../../components/conversation/conversation-details/ConversationNotificationsSettings'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getConversationByIdSelector } from '../selectors/conversations'; import { strictAssert } from '../../util/assert'; diff --git a/ts/state/smart/ConversationView.tsx b/ts/state/smart/ConversationView.tsx index 4b0e59757..cf19c4fe9 100644 --- a/ts/state/smart/ConversationView.tsx +++ b/ts/state/smart/ConversationView.tsx @@ -5,16 +5,13 @@ import React from 'react'; import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { ConversationView } from '../../components/conversation/ConversationView'; -import { StateType } from '../reducer'; -import { - SmartCompositionArea, - CompositionAreaPropsType, -} from './CompositionArea'; -import { - SmartConversationHeader, - OwnProps as ConversationHeaderPropsType, -} from './ConversationHeader'; -import { SmartTimeline, TimelinePropsType } from './Timeline'; +import type { StateType } from '../reducer'; +import type { CompositionAreaPropsType } from './CompositionArea'; +import { SmartCompositionArea } from './CompositionArea'; +import type { OwnProps as ConversationHeaderPropsType } from './ConversationHeader'; +import { SmartConversationHeader } from './ConversationHeader'; +import type { TimelinePropsType } from './Timeline'; +import { SmartTimeline } from './Timeline'; export type PropsType = { compositionAreaProps: Pick< diff --git a/ts/state/smart/EmojiPicker.tsx b/ts/state/smart/EmojiPicker.tsx index 54f7a9864..1c02779cd 100644 --- a/ts/state/smart/EmojiPicker.tsx +++ b/ts/state/smart/EmojiPicker.tsx @@ -3,17 +3,15 @@ import * as React from 'react'; import { useSelector } from 'react-redux'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { useRecentEmojis } from '../selectors/emojis'; import { useActions as useEmojiActions } from '../ducks/emojis'; -import { - EmojiPicker, - Props as EmojiPickerProps, -} from '../../components/emoji/EmojiPicker'; +import type { Props as EmojiPickerProps } from '../../components/emoji/EmojiPicker'; +import { EmojiPicker } from '../../components/emoji/EmojiPicker'; import { getIntl } from '../selectors/user'; import { getEmojiSkinTone } from '../selectors/items'; -import { LocalizerType } from '../../types/Util'; +import type { LocalizerType } from '../../types/Util'; export const SmartEmojiPicker = React.forwardRef< HTMLDivElement, diff --git a/ts/state/smart/ExpiredBuildDialog.tsx b/ts/state/smart/ExpiredBuildDialog.tsx index 7b8b5729a..b365f57b7 100644 --- a/ts/state/smart/ExpiredBuildDialog.tsx +++ b/ts/state/smart/ExpiredBuildDialog.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { DialogExpiredBuild } from '../../components/DialogExpiredBuild'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import type { WidthBreakpoint } from '../../components/_util'; diff --git a/ts/state/smart/ForwardMessageModal.tsx b/ts/state/smart/ForwardMessageModal.tsx index cad596540..ca92a533a 100644 --- a/ts/state/smart/ForwardMessageModal.tsx +++ b/ts/state/smart/ForwardMessageModal.tsx @@ -3,19 +3,17 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - ForwardMessageModal, - DataPropsType, -} from '../../components/ForwardMessageModal'; -import { StateType } from '../reducer'; -import { BodyRangeType } from '../../types/Util'; -import { LinkPreviewType } from '../../types/message/LinkPreviews'; +import type { DataPropsType } from '../../components/ForwardMessageModal'; +import { ForwardMessageModal } from '../../components/ForwardMessageModal'; +import type { StateType } from '../reducer'; +import type { BodyRangeType } from '../../types/Util'; +import type { LinkPreviewType } from '../../types/message/LinkPreviews'; import { getAllComposableConversations } from '../selectors/conversations'; import { getLinkPreview } from '../selectors/linkPreviews'; import { getIntl } from '../selectors/user'; import { getEmojiSkinTone } from '../selectors/items'; import { selectRecentEmojis } from '../selectors/emojis'; -import { AttachmentType } from '../../types/Attachment'; +import type { AttachmentType } from '../../types/Attachment'; export type SmartForwardMessageModalProps = { attachments?: Array; diff --git a/ts/state/smart/GlobalAudioProvider.tsx b/ts/state/smart/GlobalAudioProvider.tsx index f31fc4d57..a56f613a2 100644 --- a/ts/state/smart/GlobalAudioProvider.tsx +++ b/ts/state/smart/GlobalAudioProvider.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { GlobalAudioProvider } from '../../components/GlobalAudioContext'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { isPaused } from '../selectors/audioPlayer'; import { getSelectedConversationId } from '../selectors/conversations'; diff --git a/ts/state/smart/GlobalModalContainer.tsx b/ts/state/smart/GlobalModalContainer.tsx index 018cebdce..f25c7c1e4 100644 --- a/ts/state/smart/GlobalModalContainer.tsx +++ b/ts/state/smart/GlobalModalContainer.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { GlobalModalContainer } from '../../components/GlobalModalContainer'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { SmartProfileEditorModal } from './ProfileEditorModal'; import { SmartContactModal } from './ContactModal'; import { SmartSafetyNumberModal } from './SafetyNumberModal'; diff --git a/ts/state/smart/GroupLinkManagement.tsx b/ts/state/smart/GroupLinkManagement.tsx index 0e9150fef..290ac3360 100644 --- a/ts/state/smart/GroupLinkManagement.tsx +++ b/ts/state/smart/GroupLinkManagement.tsx @@ -3,11 +3,9 @@ import { connect } from 'react-redux'; -import { StateType } from '../reducer'; -import { - GroupLinkManagement, - PropsType, -} from '../../components/conversation/conversation-details/GroupLinkManagement'; +import type { StateType } from '../reducer'; +import type { PropsType } from '../../components/conversation/conversation-details/GroupLinkManagement'; +import { GroupLinkManagement } from '../../components/conversation/conversation-details/GroupLinkManagement'; import { getConversationSelector } from '../selectors/conversations'; import { getIntl } from '../selectors/user'; diff --git a/ts/state/smart/GroupV1MigrationDialog.tsx b/ts/state/smart/GroupV1MigrationDialog.tsx index c7c914751..3fafa1bee 100644 --- a/ts/state/smart/GroupV1MigrationDialog.tsx +++ b/ts/state/smart/GroupV1MigrationDialog.tsx @@ -3,12 +3,10 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - GroupV1MigrationDialog, - PropsType as GroupV1MigrationDialogPropsType, -} from '../../components/GroupV1MigrationDialog'; -import { ConversationType } from '../ducks/conversations'; -import { StateType } from '../reducer'; +import type { PropsType as GroupV1MigrationDialogPropsType } from '../../components/GroupV1MigrationDialog'; +import { GroupV1MigrationDialog } from '../../components/GroupV1MigrationDialog'; +import type { ConversationType } from '../ducks/conversations'; +import type { StateType } from '../reducer'; import { getConversationSelector } from '../selectors/conversations'; import { getIntl } from '../selectors/user'; diff --git a/ts/state/smart/GroupV2JoinDialog.tsx b/ts/state/smart/GroupV2JoinDialog.tsx index 1445732db..bdc48a9e5 100644 --- a/ts/state/smart/GroupV2JoinDialog.tsx +++ b/ts/state/smart/GroupV2JoinDialog.tsx @@ -3,11 +3,9 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - GroupV2JoinDialog, - PropsType as GroupV2JoinDialogPropsType, -} from '../../components/GroupV2JoinDialog'; -import { StateType } from '../reducer'; +import type { PropsType as GroupV2JoinDialogPropsType } from '../../components/GroupV2JoinDialog'; +import { GroupV2JoinDialog } from '../../components/GroupV2JoinDialog'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getPreJoinConversation } from '../selectors/conversations'; diff --git a/ts/state/smart/GroupV2Permissions.tsx b/ts/state/smart/GroupV2Permissions.tsx index 64cf0d0b6..fd95f4449 100644 --- a/ts/state/smart/GroupV2Permissions.tsx +++ b/ts/state/smart/GroupV2Permissions.tsx @@ -3,11 +3,9 @@ import { connect } from 'react-redux'; -import { StateType } from '../reducer'; -import { - GroupV2Permissions, - PropsType, -} from '../../components/conversation/conversation-details/GroupV2Permissions'; +import type { StateType } from '../reducer'; +import type { PropsType } from '../../components/conversation/conversation-details/GroupV2Permissions'; +import { GroupV2Permissions } from '../../components/conversation/conversation-details/GroupV2Permissions'; import { getConversationSelector } from '../selectors/conversations'; import { getIntl } from '../selectors/user'; diff --git a/ts/state/smart/HeroRow.tsx b/ts/state/smart/HeroRow.tsx index ad27fae4d..40970ac0b 100644 --- a/ts/state/smart/HeroRow.tsx +++ b/ts/state/smart/HeroRow.tsx @@ -6,7 +6,7 @@ import { mapDispatchToProps } from '../actions'; import { ConversationHero } from '../../components/conversation/ConversationHero'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; type ExternalProps = { diff --git a/ts/state/smart/LastSeenIndicator.tsx b/ts/state/smart/LastSeenIndicator.tsx index 5b2796323..6066196a8 100644 --- a/ts/state/smart/LastSeenIndicator.tsx +++ b/ts/state/smart/LastSeenIndicator.tsx @@ -6,7 +6,7 @@ import { mapDispatchToProps } from '../actions'; import { LastSeenIndicator } from '../../components/conversation/LastSeenIndicator'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getConversationMessagesSelector } from '../selectors/conversations'; diff --git a/ts/state/smart/LeftPane.tsx b/ts/state/smart/LeftPane.tsx index 0adc625cd..1ff3d5283 100644 --- a/ts/state/smart/LeftPane.tsx +++ b/ts/state/smart/LeftPane.tsx @@ -5,12 +5,9 @@ import React from 'react'; import { connect } from 'react-redux'; import { get } from 'lodash'; import { mapDispatchToProps } from '../actions'; -import { - LeftPane, - LeftPaneMode, - PropsType as LeftPanePropsType, -} from '../../components/LeftPane'; -import { StateType } from '../reducer'; +import type { PropsType as LeftPanePropsType } from '../../components/LeftPane'; +import { LeftPane, LeftPaneMode } from '../../components/LeftPane'; +import type { StateType } from '../reducer'; import { missingCaseError } from '../../util/missingCaseError'; import { ComposerStep, OneTimeModalState } from '../ducks/conversations'; diff --git a/ts/state/smart/MainHeader.tsx b/ts/state/smart/MainHeader.tsx index 4fbb965f2..ff3d3abc7 100644 --- a/ts/state/smart/MainHeader.tsx +++ b/ts/state/smart/MainHeader.tsx @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { MainHeader } from '../../components/MainHeader'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getQuery, diff --git a/ts/state/smart/MessageAudio.tsx b/ts/state/smart/MessageAudio.tsx index 23e9ae9a4..bda9f6960 100644 --- a/ts/state/smart/MessageAudio.tsx +++ b/ts/state/smart/MessageAudio.tsx @@ -4,12 +4,12 @@ import { connect } from 'react-redux'; import { MessageAudio } from '../../components/conversation/MessageAudio'; -import { ComputePeaksResult } from '../../components/GlobalAudioContext'; +import type { ComputePeaksResult } from '../../components/GlobalAudioContext'; import { mapDispatchToProps } from '../actions'; -import { StateType } from '../reducer'; -import { LocalizerType } from '../../types/Util'; -import { AttachmentType } from '../../types/Attachment'; +import type { StateType } from '../reducer'; +import type { LocalizerType } from '../../types/Util'; +import type { AttachmentType } from '../../types/Attachment'; import type { DirectionType, MessageStatusType, diff --git a/ts/state/smart/MessageDetail.tsx b/ts/state/smart/MessageDetail.tsx index eeb49e680..ec6975fc0 100644 --- a/ts/state/smart/MessageDetail.tsx +++ b/ts/state/smart/MessageDetail.tsx @@ -3,13 +3,11 @@ import { connect } from 'react-redux'; -import { - MessageDetail, - ExternalProps as MessageDetailProps, -} from '../../components/conversation/MessageDetail'; +import type { ExternalProps as MessageDetailProps } from '../../components/conversation/MessageDetail'; +import { MessageDetail } from '../../components/conversation/MessageDetail'; import { mapDispatchToProps } from '../actions'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl, getInteractionMode } from '../selectors/user'; import { renderAudioAttachment } from './renderAudioAttachment'; import { renderEmojiPicker } from './renderEmojiPicker'; diff --git a/ts/state/smart/MessageSearchResult.tsx b/ts/state/smart/MessageSearchResult.tsx index b42832c69..3d78ff8f9 100644 --- a/ts/state/smart/MessageSearchResult.tsx +++ b/ts/state/smart/MessageSearchResult.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { CSSProperties } from 'react'; +import type { CSSProperties } from 'react'; import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { MessageSearchResult } from '../../components/conversationList/MessageSearchResult'; import { getIntl } from '../selectors/user'; diff --git a/ts/state/smart/NetworkStatus.tsx b/ts/state/smart/NetworkStatus.tsx index f24333c58..9cdd8589f 100644 --- a/ts/state/smart/NetworkStatus.tsx +++ b/ts/state/smart/NetworkStatus.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { DialogNetworkStatus } from '../../components/DialogNetworkStatus'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { hasNetworkDialog } from '../selectors/network'; import type { WidthBreakpoint } from '../../components/_util'; diff --git a/ts/state/smart/PendingInvites.tsx b/ts/state/smart/PendingInvites.tsx index 38a479fca..36dca28d3 100644 --- a/ts/state/smart/PendingInvites.tsx +++ b/ts/state/smart/PendingInvites.tsx @@ -3,11 +3,9 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - PendingInvites, - PropsType, -} from '../../components/conversation/conversation-details/PendingInvites'; -import { StateType } from '../reducer'; +import type { PropsType } from '../../components/conversation/conversation-details/PendingInvites'; +import { PendingInvites } from '../../components/conversation/conversation-details/PendingInvites'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getConversationByIdSelector } from '../selectors/conversations'; diff --git a/ts/state/smart/ProfileEditorModal.ts b/ts/state/smart/ProfileEditorModal.ts index ebe91e4c0..f0af38297 100644 --- a/ts/state/smart/ProfileEditorModal.ts +++ b/ts/state/smart/ProfileEditorModal.ts @@ -3,12 +3,10 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - ProfileEditorModal, - PropsDataType as ProfileEditorModalPropsType, -} from '../../components/ProfileEditorModal'; -import { PropsDataType } from '../../components/ProfileEditor'; -import { StateType } from '../reducer'; +import type { PropsDataType as ProfileEditorModalPropsType } from '../../components/ProfileEditorModal'; +import { ProfileEditorModal } from '../../components/ProfileEditorModal'; +import type { PropsDataType } from '../../components/ProfileEditor'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getEmojiSkinTone } from '../selectors/items'; import { getMe } from '../selectors/conversations'; diff --git a/ts/state/smart/ReactionPicker.tsx b/ts/state/smart/ReactionPicker.tsx index 63a2e2463..dba108baf 100644 --- a/ts/state/smart/ReactionPicker.tsx +++ b/ts/state/smart/ReactionPicker.tsx @@ -3,18 +3,16 @@ import * as React from 'react'; import { useSelector } from 'react-redux'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { useActions as usePreferredReactionsActions } from '../ducks/preferredReactions'; import { useActions as useItemsActions } from '../ducks/items'; import { getIntl } from '../selectors/user'; import { getPreferredReactionEmoji } from '../selectors/items'; -import { LocalizerType } from '../../types/Util'; -import { - ReactionPicker, - Props, -} from '../../components/conversation/ReactionPicker'; +import type { LocalizerType } from '../../types/Util'; +import type { Props } from '../../components/conversation/ReactionPicker'; +import { ReactionPicker } from '../../components/conversation/ReactionPicker'; type ExternalProps = Omit< Props, diff --git a/ts/state/smart/RelinkDialog.tsx b/ts/state/smart/RelinkDialog.tsx index 87c4e4e14..ce2f0cd5d 100644 --- a/ts/state/smart/RelinkDialog.tsx +++ b/ts/state/smart/RelinkDialog.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { DialogRelink } from '../../components/DialogRelink'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { isDone } from '../../util/registration'; import type { WidthBreakpoint } from '../../components/_util'; diff --git a/ts/state/smart/SafetyNumberModal.tsx b/ts/state/smart/SafetyNumberModal.tsx index 3ffa03624..728adcb62 100644 --- a/ts/state/smart/SafetyNumberModal.tsx +++ b/ts/state/smart/SafetyNumberModal.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { SafetyNumberModal } from '../../components/SafetyNumberModal'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getContactSafetyNumber } from '../selectors/safetyNumber'; import { getConversationSelector } from '../selectors/conversations'; import { getIntl } from '../selectors/user'; diff --git a/ts/state/smart/SafetyNumberViewer.tsx b/ts/state/smart/SafetyNumberViewer.tsx index 567cee320..c170dd94b 100644 --- a/ts/state/smart/SafetyNumberViewer.tsx +++ b/ts/state/smart/SafetyNumberViewer.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { SafetyNumberViewer } from '../../components/SafetyNumberViewer'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getContactSafetyNumber } from '../selectors/safetyNumber'; import { getConversationSelector } from '../selectors/conversations'; import { getIntl } from '../selectors/user'; diff --git a/ts/state/smart/ShortcutGuideModal.tsx b/ts/state/smart/ShortcutGuideModal.tsx index e92e7a735..83e72ef37 100644 --- a/ts/state/smart/ShortcutGuideModal.tsx +++ b/ts/state/smart/ShortcutGuideModal.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { ShortcutGuideModal } from '../../components/ShortcutGuideModal'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { countStickers } from '../../components/stickers/lib'; import { getIntl, getPlatform } from '../selectors/user'; diff --git a/ts/state/smart/StickerManager.tsx b/ts/state/smart/StickerManager.tsx index 451b6bc4d..b9804f2ee 100644 --- a/ts/state/smart/StickerManager.tsx +++ b/ts/state/smart/StickerManager.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { StickerManager } from '../../components/stickers/StickerManager'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { diff --git a/ts/state/smart/StickerPreviewModal.tsx b/ts/state/smart/StickerPreviewModal.tsx index bc8ea0c6f..abc84e505 100644 --- a/ts/state/smart/StickerPreviewModal.tsx +++ b/ts/state/smart/StickerPreviewModal.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { StickerPreviewModal } from '../../components/stickers/StickerPreviewModal'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl, getStickersPath, getTempPath } from '../selectors/user'; import { diff --git a/ts/state/smart/Timeline.tsx b/ts/state/smart/Timeline.tsx index 24bd6e844..58c118a26 100644 --- a/ts/state/smart/Timeline.tsx +++ b/ts/state/smart/Timeline.tsx @@ -2,20 +2,21 @@ // SPDX-License-Identifier: AGPL-3.0-only import { isEmpty, mapValues, pick } from 'lodash'; -import React, { RefObject } from 'react'; +import type { RefObject } from 'react'; +import React from 'react'; import { connect } from 'react-redux'; import memoizee from 'memoizee'; import { mapDispatchToProps } from '../actions'; -import { +import type { PropsActionsType as TimelineActionsType, ContactSpoofingReviewPropType, - Timeline, WarningType as TimelineWarningType, PropsType as ComponentPropsType, } from '../../components/conversation/Timeline'; -import { StateType } from '../reducer'; -import { ConversationType } from '../ducks/conversations'; +import { Timeline } from '../../components/conversation/Timeline'; +import type { StateType } from '../reducer'; +import type { ConversationType } from '../ducks/conversations'; import { getIntl } from '../selectors/user'; import { diff --git a/ts/state/smart/TimelineItem.tsx b/ts/state/smart/TimelineItem.tsx index 8bc6ddd50..d373314b1 100644 --- a/ts/state/smart/TimelineItem.tsx +++ b/ts/state/smart/TimelineItem.tsx @@ -1,11 +1,12 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { RefObject } from 'react'; +import type { RefObject } from 'react'; +import React from 'react'; import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { TimelineItem } from '../../components/conversation/TimelineItem'; import { getIntl, getInteractionMode, getTheme } from '../selectors/user'; diff --git a/ts/state/smart/TimelineLoadingRow.tsx b/ts/state/smart/TimelineLoadingRow.tsx index 1f31a525d..3584a791b 100644 --- a/ts/state/smart/TimelineLoadingRow.tsx +++ b/ts/state/smart/TimelineLoadingRow.tsx @@ -5,13 +5,11 @@ import { isNumber } from 'lodash'; import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; -import { - STATE_ENUM, - TimelineLoadingRow, -} from '../../components/conversation/TimelineLoadingRow'; +import type { STATE_ENUM } from '../../components/conversation/TimelineLoadingRow'; +import { TimelineLoadingRow } from '../../components/conversation/TimelineLoadingRow'; import { LOAD_COUNTDOWN } from '../../components/conversation/Timeline'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getConversationMessagesSelector } from '../selectors/conversations'; diff --git a/ts/state/smart/TypingBubble.tsx b/ts/state/smart/TypingBubble.tsx index 6da6615be..5ac2d0f70 100644 --- a/ts/state/smart/TypingBubble.tsx +++ b/ts/state/smart/TypingBubble.tsx @@ -5,7 +5,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { TypingBubble } from '../../components/conversation/TypingBubble'; import { strictAssert } from '../../util/assert'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getConversationSelector } from '../selectors/conversations'; diff --git a/ts/state/smart/UniversalTimerNotification.tsx b/ts/state/smart/UniversalTimerNotification.tsx index 08d648334..3c4e64e70 100644 --- a/ts/state/smart/UniversalTimerNotification.tsx +++ b/ts/state/smart/UniversalTimerNotification.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { UniversalTimerNotification } from '../../components/conversation/UniversalTimerNotification'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { getUniversalExpireTimer } from '../selectors/items'; diff --git a/ts/state/smart/UpdateDialog.tsx b/ts/state/smart/UpdateDialog.tsx index 54aefa6d9..93288304b 100644 --- a/ts/state/smart/UpdateDialog.tsx +++ b/ts/state/smart/UpdateDialog.tsx @@ -4,7 +4,7 @@ import { connect } from 'react-redux'; import { mapDispatchToProps } from '../actions'; import { DialogUpdate } from '../../components/DialogUpdate'; -import { StateType } from '../reducer'; +import type { StateType } from '../reducer'; import { getIntl } from '../selectors/user'; import { hasNetworkDialog } from '../selectors/network'; import type { WidthBreakpoint } from '../../components/_util'; diff --git a/ts/state/smart/renderAudioAttachment.tsx b/ts/state/smart/renderAudioAttachment.tsx index dfa7c1c55..083aab966 100644 --- a/ts/state/smart/renderAudioAttachment.tsx +++ b/ts/state/smart/renderAudioAttachment.tsx @@ -1,9 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ReactElement } from 'react'; +import type { ReactElement } from 'react'; +import React from 'react'; import { GlobalAudioContext } from '../../components/GlobalAudioContext'; -import { SmartMessageAudio, Props as MessageAudioProps } from './MessageAudio'; +import type { Props as MessageAudioProps } from './MessageAudio'; +import { SmartMessageAudio } from './MessageAudio'; type AudioAttachmentProps = Omit; diff --git a/ts/state/smart/renderEmojiPicker.tsx b/ts/state/smart/renderEmojiPicker.tsx index c07e9fb5b..8d9f6a94c 100644 --- a/ts/state/smart/renderEmojiPicker.tsx +++ b/ts/state/smart/renderEmojiPicker.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { RenderEmojiPickerProps } from '../../components/conversation/ReactionPicker'; +import type { RenderEmojiPickerProps } from '../../components/conversation/ReactionPicker'; import { SmartEmojiPicker } from './EmojiPicker'; export function renderEmojiPicker({ diff --git a/ts/state/smart/renderReactionPicker.tsx b/ts/state/smart/renderReactionPicker.tsx index 8a9af8e2a..002b51e8e 100644 --- a/ts/state/smart/renderReactionPicker.tsx +++ b/ts/state/smart/renderReactionPicker.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { ComponentProps } from 'react'; +import type { ComponentProps } from 'react'; +import React from 'react'; import { SmartReactionPicker } from './ReactionPicker'; diff --git a/ts/state/types.ts b/ts/state/types.ts index f014fefe2..4c9d1cd14 100644 --- a/ts/state/types.ts +++ b/ts/state/types.ts @@ -1,24 +1,24 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { actions as accounts } from './ducks/accounts'; -import { actions as app } from './ducks/app'; -import { actions as audioPlayer } from './ducks/audioPlayer'; -import { actions as audioRecorder } from './ducks/audioRecorder'; -import { actions as calling } from './ducks/calling'; -import { actions as composer } from './ducks/composer'; -import { actions as conversations } from './ducks/conversations'; -import { actions as emojis } from './ducks/emojis'; -import { actions as expiration } from './ducks/expiration'; -import { actions as globalModals } from './ducks/globalModals'; -import { actions as items } from './ducks/items'; -import { actions as linkPreviews } from './ducks/linkPreviews'; -import { actions as network } from './ducks/network'; -import { actions as safetyNumber } from './ducks/safetyNumber'; -import { actions as search } from './ducks/search'; -import { actions as stickers } from './ducks/stickers'; -import { actions as updates } from './ducks/updates'; -import { actions as user } from './ducks/user'; +import type { actions as accounts } from './ducks/accounts'; +import type { actions as app } from './ducks/app'; +import type { actions as audioPlayer } from './ducks/audioPlayer'; +import type { actions as audioRecorder } from './ducks/audioRecorder'; +import type { actions as calling } from './ducks/calling'; +import type { actions as composer } from './ducks/composer'; +import type { actions as conversations } from './ducks/conversations'; +import type { actions as emojis } from './ducks/emojis'; +import type { actions as expiration } from './ducks/expiration'; +import type { actions as globalModals } from './ducks/globalModals'; +import type { actions as items } from './ducks/items'; +import type { actions as linkPreviews } from './ducks/linkPreviews'; +import type { actions as network } from './ducks/network'; +import type { actions as safetyNumber } from './ducks/safetyNumber'; +import type { actions as search } from './ducks/search'; +import type { actions as stickers } from './ducks/stickers'; +import type { actions as updates } from './ducks/updates'; +import type { actions as user } from './ducks/user'; export type ReduxActions = { accounts: typeof accounts; diff --git a/ts/test-both/challenge_test.ts b/ts/test-both/challenge_test.ts index b573221e1..b98625211 100644 --- a/ts/test-both/challenge_test.ts +++ b/ts/test-both/challenge_test.ts @@ -7,7 +7,8 @@ import { assert } from 'chai'; import { noop } from 'lodash'; import * as sinon from 'sinon'; -import { ChallengeHandler, MinimalMessage } from '../challenge'; +import type { MinimalMessage } from '../challenge'; +import { ChallengeHandler } from '../challenge'; type CreateMessageOptions = { readonly sentAt?: number; diff --git a/ts/test-both/helpers/FakeLeftPaneContainer.tsx b/ts/test-both/helpers/FakeLeftPaneContainer.tsx index f42fb28f9..9dd95db8a 100644 --- a/ts/test-both/helpers/FakeLeftPaneContainer.tsx +++ b/ts/test-both/helpers/FakeLeftPaneContainer.tsx @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import React, { FunctionComponent } from 'react'; +import type { FunctionComponent } from 'react'; +import React from 'react'; import { WidthBreakpoint } from '../../components/_util'; type PropsType = { diff --git a/ts/test-both/helpers/getDefaultConversation.ts b/ts/test-both/helpers/getDefaultConversation.ts index a567175c0..21aebdad8 100644 --- a/ts/test-both/helpers/getDefaultConversation.ts +++ b/ts/test-both/helpers/getDefaultConversation.ts @@ -3,7 +3,7 @@ import { v4 as generateUuid } from 'uuid'; import { sample } from 'lodash'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import { getRandomColor } from './getRandomColor'; const FIRST_NAMES = [ diff --git a/ts/test-both/helpers/getRandomColor.ts b/ts/test-both/helpers/getRandomColor.ts index 8456845fe..d20f5b234 100644 --- a/ts/test-both/helpers/getRandomColor.ts +++ b/ts/test-both/helpers/getRandomColor.ts @@ -2,7 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { sample } from 'lodash'; -import { AvatarColors, AvatarColorType } from '../../types/Colors'; +import type { AvatarColorType } from '../../types/Colors'; +import { AvatarColors } from '../../types/Colors'; export function getRandomColor(): AvatarColorType { return sample(AvatarColors) || AvatarColors[0]; diff --git a/ts/test-both/messages/MessageSendState_test.ts b/ts/test-both/messages/MessageSendState_test.ts index 4b783403a..71b28b5d6 100644 --- a/ts/test-both/messages/MessageSendState_test.ts +++ b/ts/test-both/messages/MessageSendState_test.ts @@ -5,11 +5,13 @@ import { assert } from 'chai'; import { sampleSize, times } from 'lodash'; import { v4 as uuid } from 'uuid'; -import { +import type { SendAction, - SendActionType, SendState, SendStateByConversationId, +} from '../../messages/MessageSendState'; +import { + SendActionType, SendStatus, isDelivered, isFailed, diff --git a/ts/test-both/messages/migrateLegacySendAttributes_test.ts b/ts/test-both/messages/migrateLegacySendAttributes_test.ts index 07e87b760..643aef447 100644 --- a/ts/test-both/messages/migrateLegacySendAttributes_test.ts +++ b/ts/test-both/messages/migrateLegacySendAttributes_test.ts @@ -4,7 +4,7 @@ import { assert } from 'chai'; import { v4 as uuid } from 'uuid'; import { getDefaultConversation } from '../helpers/getDefaultConversation'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import { SendStatus } from '../../messages/MessageSendState'; import { migrateLegacySendAttributes } from '../../messages/migrateLegacySendAttributes'; diff --git a/ts/test-both/processDataMessage_test.ts b/ts/test-both/processDataMessage_test.ts index c04f74082..ae1bf214e 100644 --- a/ts/test-both/processDataMessage_test.ts +++ b/ts/test-both/processDataMessage_test.ts @@ -8,7 +8,7 @@ import { processDataMessage, ATTACHMENT_MAX, } from '../textsecure/processDataMessage'; -import { ProcessedAttachment } from '../textsecure/Types.d'; +import type { ProcessedAttachment } from '../textsecure/Types.d'; import { SignalService as Proto } from '../protobuf'; const FLAGS = Proto.DataMessage.Flags; diff --git a/ts/test-both/state/ducks/audioPlayer_test.ts b/ts/test-both/state/ducks/audioPlayer_test.ts index 3fca5d6c2..c1445c753 100644 --- a/ts/test-both/state/ducks/audioPlayer_test.ts +++ b/ts/test-both/state/ducks/audioPlayer_test.ts @@ -4,13 +4,12 @@ import { assert } from 'chai'; import { actions } from '../../../state/ducks/audioPlayer'; -import { - actions as conversationsActions, - SwitchToAssociatedViewActionType, -} from '../../../state/ducks/conversations'; +import type { SwitchToAssociatedViewActionType } from '../../../state/ducks/conversations'; +import { actions as conversationsActions } from '../../../state/ducks/conversations'; import { noopAction } from '../../../state/ducks/noop'; -import { StateType, reducer as rootReducer } from '../../../state/reducer'; +import type { StateType } from '../../../state/reducer'; +import { reducer as rootReducer } from '../../../state/reducer'; const { messageDeleted, messageChanged } = conversationsActions; diff --git a/ts/test-both/state/ducks/composer_test.ts b/ts/test-both/state/ducks/composer_test.ts index 3f332e508..f7b751dbf 100644 --- a/ts/test-both/state/ducks/composer_test.ts +++ b/ts/test-both/state/ducks/composer_test.ts @@ -9,7 +9,7 @@ import { noopAction } from '../../../state/ducks/noop'; import { reducer as rootReducer } from '../../../state/reducer'; import { IMAGE_JPEG } from '../../../types/MIME'; -import { AttachmentType } from '../../../types/Attachment'; +import type { AttachmentType } from '../../../types/Attachment'; import { fakeAttachment } from '../../helpers/fakeAttachment'; describe('both/state/ducks/composer', () => { diff --git a/ts/test-both/state/ducks/linkPreviews_test.ts b/ts/test-both/state/ducks/linkPreviews_test.ts index 94ed5cca6..a43307148 100644 --- a/ts/test-both/state/ducks/linkPreviews_test.ts +++ b/ts/test-both/state/ducks/linkPreviews_test.ts @@ -8,7 +8,7 @@ import { getEmptyState, reducer, } from '../../../state/ducks/linkPreviews'; -import { LinkPreviewType } from '../../../types/message/LinkPreviews'; +import type { LinkPreviewType } from '../../../types/message/LinkPreviews'; describe('both/state/ducks/linkPreviews', () => { function getMockLinkPreview(): LinkPreviewType { diff --git a/ts/test-both/state/ducks/preferredReactions_test.ts b/ts/test-both/state/ducks/preferredReactions_test.ts index 55601fb90..3580edb45 100644 --- a/ts/test-both/state/ducks/preferredReactions_test.ts +++ b/ts/test-both/state/ducks/preferredReactions_test.ts @@ -3,11 +3,12 @@ import { assert } from 'chai'; import * as sinon from 'sinon'; -import { StateType, reducer as rootReducer } from '../../../state/reducer'; +import type { StateType } from '../../../state/reducer'; +import { reducer as rootReducer } from '../../../state/reducer'; import { noopAction } from '../../../state/ducks/noop'; +import type { PreferredReactionsStateType } from '../../../state/ducks/preferredReactions'; import { - PreferredReactionsStateType, actions, getInitialState, reducer, diff --git a/ts/test-both/state/selectors/conversations_test.ts b/ts/test-both/state/selectors/conversations_test.ts index e323e8921..2f62235a0 100644 --- a/ts/test-both/state/selectors/conversations_test.ts +++ b/ts/test-both/state/selectors/conversations_test.ts @@ -3,11 +3,13 @@ import { assert } from 'chai'; +import type { + ConversationLookupType, + ConversationType, +} from '../../../state/ducks/conversations'; import { OneTimeModalState, ComposerStep, - ConversationLookupType, - ConversationType, getEmptyState, } from '../../../state/ducks/conversations'; import { @@ -43,7 +45,8 @@ import { isCreatingGroup, } from '../../../state/selectors/conversations'; import { noopAction } from '../../../state/ducks/noop'; -import { StateType, reducer as rootReducer } from '../../../state/reducer'; +import type { StateType } from '../../../state/reducer'; +import { reducer as rootReducer } from '../../../state/reducer'; import { setupI18n } from '../../../util/setupI18n'; import enMessages from '../../../../_locales/en/messages.json'; import { getDefaultConversation } from '../../helpers/getDefaultConversation'; diff --git a/ts/test-both/state/selectors/search_test.ts b/ts/test-both/state/selectors/search_test.ts index 07afd4bf5..b2df81340 100644 --- a/ts/test-both/state/selectors/search_test.ts +++ b/ts/test-both/state/selectors/search_test.ts @@ -4,16 +4,14 @@ import { assert } from 'chai'; import sinon from 'sinon'; -import { +import type { ConversationType, - getEmptyState as getEmptyConversationState, MessageType, } from '../../../state/ducks/conversations'; +import { getEmptyState as getEmptyConversationState } from '../../../state/ducks/conversations'; import { noopAction } from '../../../state/ducks/noop'; -import { - getEmptyState as getEmptySearchState, - MessageSearchResultType, -} from '../../../state/ducks/search'; +import type { MessageSearchResultType } from '../../../state/ducks/search'; +import { getEmptyState as getEmptySearchState } from '../../../state/ducks/search'; import { getEmptyState as getEmptyUserState } from '../../../state/ducks/user'; import { getIsSearchingInAConversation, @@ -24,7 +22,8 @@ import { makeLookup } from '../../../util/makeLookup'; import { getDefaultConversation } from '../../helpers/getDefaultConversation'; import { ReadStatus } from '../../../messages/MessageReadStatus'; -import { StateType, reducer as rootReducer } from '../../../state/reducer'; +import type { StateType } from '../../../state/reducer'; +import { reducer as rootReducer } from '../../../state/reducer'; describe('both/state/selectors/search', () => { const NOW = 1_000_000; diff --git a/ts/test-both/util/asyncIterables_test.ts b/ts/test-both/util/asyncIterables_test.ts index f04678876..b1959b21f 100644 --- a/ts/test-both/util/asyncIterables_test.ts +++ b/ts/test-both/util/asyncIterables_test.ts @@ -5,11 +5,8 @@ import { assert } from 'chai'; -import { - MaybeAsyncIterable, - concat, - wrapPromise, -} from '../../util/asyncIterables'; +import type { MaybeAsyncIterable } from '../../util/asyncIterables'; +import { concat, wrapPromise } from '../../util/asyncIterables'; describe('async iterable utilities', () => { describe('concat', () => { diff --git a/ts/test-both/util/getGroupMemberships_test.ts b/ts/test-both/util/getGroupMemberships_test.ts index 691d1220c..8b7d27485 100644 --- a/ts/test-both/util/getGroupMemberships_test.ts +++ b/ts/test-both/util/getGroupMemberships_test.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { assert } from 'chai'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import { getDefaultConversation } from '../helpers/getDefaultConversation'; import { getGroupMemberships } from '../../util/getGroupMemberships'; diff --git a/ts/test-both/util/retryPlaceholders_test.ts b/ts/test-both/util/retryPlaceholders_test.ts index 623287990..be2234b98 100644 --- a/ts/test-both/util/retryPlaceholders_test.ts +++ b/ts/test-both/util/retryPlaceholders_test.ts @@ -4,9 +4,9 @@ import { assert } from 'chai'; import sinon from 'sinon'; +import type { RetryItemType } from '../../util/retryPlaceholders'; import { getDeltaIntoPast, - RetryItemType, RetryPlaceholders, STORAGE_KEY, } from '../../util/retryPlaceholders'; diff --git a/ts/test-both/util/sessionTranslation_test.ts b/ts/test-both/util/sessionTranslation_test.ts index 1b5208424..337dc6ccc 100644 --- a/ts/test-both/util/sessionTranslation_test.ts +++ b/ts/test-both/util/sessionTranslation_test.ts @@ -6,10 +6,8 @@ import { assert } from 'chai'; import * as Bytes from '../../Bytes'; -import { - LocalUserDataType, - sessionRecordToProtobuf, -} from '../../util/sessionTranslation'; +import type { LocalUserDataType } from '../../util/sessionTranslation'; +import { sessionRecordToProtobuf } from '../../util/sessionTranslation'; const getRecordCopy = (record: any): any => JSON.parse(JSON.stringify(record)); diff --git a/ts/test-electron/MessageReceiver_test.ts b/ts/test-electron/MessageReceiver_test.ts index bd90c6a55..afe89ac8b 100644 --- a/ts/test-electron/MessageReceiver_test.ts +++ b/ts/test-electron/MessageReceiver_test.ts @@ -10,8 +10,8 @@ import { v4 as getGuid } from 'uuid'; import MessageReceiver from '../textsecure/MessageReceiver'; import { IncomingWebSocketRequest } from '../textsecure/WebsocketResources'; -import { WebAPIType } from '../textsecure/WebAPI'; -import { DecryptionErrorEvent } from '../textsecure/messageReceiverEvents'; +import type { WebAPIType } from '../textsecure/WebAPI'; +import type { DecryptionErrorEvent } from '../textsecure/messageReceiverEvents'; import { SignalService as Proto } from '../protobuf'; import * as Crypto from '../Crypto'; diff --git a/ts/test-electron/SignalProtocolStore_test.ts b/ts/test-electron/SignalProtocolStore_test.ts index c4f6a3f01..e6d650746 100644 --- a/ts/test-electron/SignalProtocolStore_test.ts +++ b/ts/test-electron/SignalProtocolStore_test.ts @@ -19,11 +19,12 @@ import { Zone } from '../util/Zone'; import * as Bytes from '../Bytes'; import { getRandomBytes, constantTimeEqual } from '../Crypto'; import { clampPrivateKey, setPublicKeyTypeByte } from '../Curve'; -import { GLOBAL_ZONE, SignalProtocolStore } from '../SignalProtocolStore'; +import type { SignalProtocolStore } from '../SignalProtocolStore'; +import { GLOBAL_ZONE } from '../SignalProtocolStore'; import { Address } from '../types/Address'; import { QualifiedAddress } from '../types/QualifiedAddress'; import { UUID } from '../types/UUID'; -import { IdentityKeyType, KeyPairType } from '../textsecure/Types.d'; +import type { IdentityKeyType, KeyPairType } from '../textsecure/Types.d'; chai.use(chaiAsPromised); diff --git a/ts/test-electron/WebsocketResources_test.ts b/ts/test-electron/WebsocketResources_test.ts index 1da306f21..347a7273f 100644 --- a/ts/test-electron/WebsocketResources_test.ts +++ b/ts/test-electron/WebsocketResources_test.ts @@ -10,7 +10,7 @@ import { assert } from 'chai'; import * as sinon from 'sinon'; import EventEmitter from 'events'; -import { connection as WebSocket } from 'websocket'; +import type { connection as WebSocket } from 'websocket'; import Long from 'long'; import { dropNull } from '../util/dropNull'; diff --git a/ts/test-electron/context/createNativeThemeListener_test.ts b/ts/test-electron/context/createNativeThemeListener_test.ts index d5df773ad..faff9dea0 100644 --- a/ts/test-electron/context/createNativeThemeListener_test.ts +++ b/ts/test-electron/context/createNativeThemeListener_test.ts @@ -4,12 +4,12 @@ import { assert } from 'chai'; import { EventEmitter } from 'events'; -import { - createNativeThemeListener, +import type { MinimalIPC, SystemThemeHolder, } from '../../context/createNativeThemeListener'; -import { NativeThemeState } from '../../types/NativeThemeNotifier.d'; +import { createNativeThemeListener } from '../../context/createNativeThemeListener'; +import type { NativeThemeState } from '../../types/NativeThemeNotifier.d'; class FakeIPC extends EventEmitter implements MinimalIPC { constructor(private readonly state: NativeThemeState) { diff --git a/ts/test-electron/models/messages_test.ts b/ts/test-electron/models/messages_test.ts index 894317445..7b19da134 100644 --- a/ts/test-electron/models/messages_test.ts +++ b/ts/test-electron/models/messages_test.ts @@ -7,8 +7,8 @@ import { setupI18n } from '../../util/setupI18n'; import enMessages from '../../../_locales/en/messages.json'; import { SendStatus } from '../../messages/MessageSendState'; import MessageSender from '../../textsecure/SendMessage'; -import { WebAPIType } from '../../textsecure/WebAPI'; -import { CallbackResultType } from '../../textsecure/Types.d'; +import type { WebAPIType } from '../../textsecure/WebAPI'; +import type { CallbackResultType } from '../../textsecure/Types.d'; import type { StorageAccessType } from '../../types/Storage.d'; import { SignalService as Proto } from '../../protobuf'; diff --git a/ts/test-electron/quill/emoji/completion_test.tsx b/ts/test-electron/quill/emoji/completion_test.tsx index a72a5d7c0..c2738a5d0 100644 --- a/ts/test-electron/quill/emoji/completion_test.tsx +++ b/ts/test-electron/quill/emoji/completion_test.tsx @@ -5,7 +5,7 @@ import { assert } from 'chai'; import sinon from 'sinon'; import { EmojiCompletion } from '../../../quill/emoji/completion'; -import { EmojiData } from '../../../components/emoji/lib'; +import type { EmojiData } from '../../../components/emoji/lib'; describe('emojiCompletion', () => { let emojiCompletion: EmojiCompletion; diff --git a/ts/test-electron/quill/mentions/completion_test.tsx b/ts/test-electron/quill/mentions/completion_test.tsx index ee63d0aca..c0dcbc9c1 100644 --- a/ts/test-electron/quill/mentions/completion_test.tsx +++ b/ts/test-electron/quill/mentions/completion_test.tsx @@ -3,15 +3,14 @@ import { assert } from 'chai'; import Delta from 'quill-delta'; -import sinon, { SinonStub } from 'sinon'; -import Quill, { KeyboardStatic } from 'quill'; +import type { SinonStub } from 'sinon'; +import sinon from 'sinon'; +import type { Quill, KeyboardStatic } from 'quill'; -import { MutableRefObject } from 'react'; -import { - MentionCompletion, - MentionCompletionOptions, -} from '../../../quill/mentions/completion'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { MutableRefObject } from 'react'; +import type { MentionCompletionOptions } from '../../../quill/mentions/completion'; +import { MentionCompletion } from '../../../quill/mentions/completion'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { MemberRepository } from '../../../quill/memberRepository'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; diff --git a/ts/test-electron/routineProfileRefresh_test.ts b/ts/test-electron/routineProfileRefresh_test.ts index 788a22563..3ae119b1d 100644 --- a/ts/test-electron/routineProfileRefresh_test.ts +++ b/ts/test-electron/routineProfileRefresh_test.ts @@ -5,7 +5,7 @@ import * as sinon from 'sinon'; import { v4 as uuid } from 'uuid'; import { times } from 'lodash'; import { ConversationModel } from '../models/conversations'; -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; import { routineProfileRefresh } from '../routineProfileRefresh'; import * as getProfileStub from '../util/getProfile'; diff --git a/ts/test-electron/state/ducks/calling_test.ts b/ts/test-electron/state/ducks/calling_test.ts index 13e2b64d7..ce0a989b3 100644 --- a/ts/test-electron/state/ducks/calling_test.ts +++ b/ts/test-electron/state/ducks/calling_test.ts @@ -5,9 +5,11 @@ import { assert } from 'chai'; import * as sinon from 'sinon'; import { reducer as rootReducer } from '../../../state/reducer'; import { noopAction } from '../../../state/ducks/noop'; -import { +import type { CallingStateType, GroupCallStateChangeActionType, +} from '../../../state/ducks/calling'; +import { actions, getActiveCall, getEmptyState, diff --git a/ts/test-electron/state/ducks/conversations_test.ts b/ts/test-electron/state/ducks/conversations_test.ts index acb3a2554..68e51d797 100644 --- a/ts/test-electron/state/ducks/conversations_test.ts +++ b/ts/test-electron/state/ducks/conversations_test.ts @@ -8,16 +8,18 @@ import { times } from 'lodash'; import { set } from 'lodash/fp'; import { reducer as rootReducer } from '../../../state/reducer'; import { noopAction } from '../../../state/ducks/noop'; -import { - actions, - OneTimeModalState, - ComposerStep, +import type { ConversationMessageType, ConversationType, ConversationsStateType, MessageType, SwitchToAssociatedViewActionType, ToggleConversationInChooseMembersActionType, +} from '../../../state/ducks/conversations'; +import { + actions, + OneTimeModalState, + ComposerStep, getConversationCallMode, getEmptyState, reducer, diff --git a/ts/test-electron/state/selectors/audioPlayer_test.ts b/ts/test-electron/state/selectors/audioPlayer_test.ts index 6a535cbda..e918e11d9 100644 --- a/ts/test-electron/state/selectors/audioPlayer_test.ts +++ b/ts/test-electron/state/selectors/audioPlayer_test.ts @@ -5,7 +5,8 @@ import { assert } from 'chai'; import { actions } from '../../../state/ducks/audioPlayer'; import { noopAction } from '../../../state/ducks/noop'; import { isPaused } from '../../../state/selectors/audioPlayer'; -import { StateType, reducer as rootReducer } from '../../../state/reducer'; +import type { StateType } from '../../../state/reducer'; +import { reducer as rootReducer } from '../../../state/reducer'; describe('state/selectors/audioPlayer', () => { const getEmptyRootState = (): StateType => { diff --git a/ts/test-electron/state/selectors/calling_test.ts b/ts/test-electron/state/selectors/calling_test.ts index 257f9ffb5..a7a10587b 100644 --- a/ts/test-electron/state/selectors/calling_test.ts +++ b/ts/test-electron/state/selectors/calling_test.ts @@ -16,12 +16,12 @@ import { getIncomingCall, isInCall, } from '../../../state/selectors/calling'; -import { - getEmptyState, +import type { CallingStateType, DirectCallStateType, GroupCallStateType, } from '../../../state/ducks/calling'; +import { getEmptyState } from '../../../state/ducks/calling'; describe('state/selectors/calling', () => { const getEmptyRootState = () => rootReducer(undefined, noopAction()); diff --git a/ts/test-electron/state/selectors/messages_test.ts b/ts/test-electron/state/selectors/messages_test.ts index 583f92225..4a4603bcd 100644 --- a/ts/test-electron/state/selectors/messages_test.ts +++ b/ts/test-electron/state/selectors/messages_test.ts @@ -5,11 +5,11 @@ import { assert } from 'chai'; import * as moment from 'moment'; import { v4 as uuid } from 'uuid'; import { SendStatus } from '../../../messages/MessageSendState'; -import { +import type { MessageAttributesType, ShallowChallengeError, } from '../../../model-types.d'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { canDeleteForEveryone, diff --git a/ts/test-electron/textsecure/AccountManager_test.ts b/ts/test-electron/textsecure/AccountManager_test.ts index 6e466b0f8..749f19fe5 100644 --- a/ts/test-electron/textsecure/AccountManager_test.ts +++ b/ts/test-electron/textsecure/AccountManager_test.ts @@ -6,7 +6,7 @@ import { v4 as getGuid } from 'uuid'; import { getRandomBytes } from '../../Crypto'; import AccountManager from '../../textsecure/AccountManager'; -import { OuterSignedPrekeyType } from '../../textsecure/Types.d'; +import type { OuterSignedPrekeyType } from '../../textsecure/Types.d'; import { UUID } from '../../types/UUID'; /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/ts/test-electron/textsecure/generate_keys_test.ts b/ts/test-electron/textsecure/generate_keys_test.ts index ae4607dde..3823bc7e7 100644 --- a/ts/test-electron/textsecure/generate_keys_test.ts +++ b/ts/test-electron/textsecure/generate_keys_test.ts @@ -6,10 +6,9 @@ import { assert } from 'chai'; import { toBase64 } from '../../Bytes'; import { constantTimeEqual } from '../../Crypto'; import { generateKeyPair } from '../../Curve'; -import AccountManager, { - GeneratedKeysType, -} from '../../textsecure/AccountManager'; -import { PreKeyType, SignedPreKeyType } from '../../textsecure/Types.d'; +import type { GeneratedKeysType } from '../../textsecure/AccountManager'; +import AccountManager from '../../textsecure/AccountManager'; +import type { PreKeyType, SignedPreKeyType } from '../../textsecure/Types.d'; import { UUID } from '../../types/UUID'; const { textsecure } = window; diff --git a/ts/test-electron/updateConversationsWithUuidLookup_test.ts b/ts/test-electron/updateConversationsWithUuidLookup_test.ts index 959b3b770..85da1a4f8 100644 --- a/ts/test-electron/updateConversationsWithUuidLookup_test.ts +++ b/ts/test-electron/updateConversationsWithUuidLookup_test.ts @@ -7,8 +7,8 @@ import { assert } from 'chai'; import sinon from 'sinon'; import { v4 as uuid } from 'uuid'; import { ConversationModel } from '../models/conversations'; -import { ConversationAttributesType } from '../model-types.d'; -import SendMessage from '../textsecure/SendMessage'; +import type { ConversationAttributesType } from '../model-types.d'; +import type SendMessage from '../textsecure/SendMessage'; import { updateConversationsWithUuidLookup } from '../updateConversationsWithUuidLookup'; diff --git a/ts/test-electron/util/sendToGroup_test.ts b/ts/test-electron/util/sendToGroup_test.ts index f55b2eb4b..42b7c80f1 100644 --- a/ts/test-electron/util/sendToGroup_test.ts +++ b/ts/test-electron/util/sendToGroup_test.ts @@ -5,7 +5,7 @@ import { assert } from 'chai'; import { _analyzeSenderKeyDevices, _waitForAll } from '../../util/sendToGroup'; -import { DeviceType } from '../../textsecure/Types.d'; +import type { DeviceType } from '../../textsecure/Types.d'; describe('sendToGroup', () => { describe('#_analyzeSenderKeyDevices', () => { diff --git a/ts/test-node/app/SystemTrayService_test.ts b/ts/test-node/app/SystemTrayService_test.ts index 0a5c46bd0..616080446 100644 --- a/ts/test-node/app/SystemTrayService_test.ts +++ b/ts/test-node/app/SystemTrayService_test.ts @@ -3,7 +3,8 @@ import { assert } from 'chai'; import * as sinon from 'sinon'; -import { BrowserWindow, MenuItem, Tray, nativeImage } from 'electron'; +import type { MenuItem } from 'electron'; +import { BrowserWindow, Tray, nativeImage } from 'electron'; import * as path from 'path'; import { SystemTrayService } from '../../../app/SystemTrayService'; diff --git a/ts/test-node/app/SystemTraySettingCache_test.ts b/ts/test-node/app/SystemTraySettingCache_test.ts index 2c9f9abbb..94bd96a30 100644 --- a/ts/test-node/app/SystemTraySettingCache_test.ts +++ b/ts/test-node/app/SystemTraySettingCache_test.ts @@ -3,7 +3,7 @@ import { assert } from 'chai'; import * as sinon from 'sinon'; -import { MainSQL } from '../../sql/main'; +import type { MainSQL } from '../../sql/main'; import { SystemTraySetting } from '../../types/SystemTraySetting'; import type { ConfigType } from '../../../app/base_config'; diff --git a/ts/test-node/components/leftPane/LeftPaneInboxHelper_test.tsx b/ts/test-node/components/leftPane/LeftPaneInboxHelper_test.tsx index 00a70da3e..024292d47 100644 --- a/ts/test-node/components/leftPane/LeftPaneInboxHelper_test.tsx +++ b/ts/test-node/components/leftPane/LeftPaneInboxHelper_test.tsx @@ -7,10 +7,8 @@ import { RowType } from '../../../components/ConversationList'; import { FindDirection } from '../../../components/leftPane/LeftPaneHelper'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; -import { - LeftPaneInboxHelper, - LeftPaneInboxPropsType, -} from '../../../components/leftPane/LeftPaneInboxHelper'; +import type { LeftPaneInboxPropsType } from '../../../components/leftPane/LeftPaneInboxHelper'; +import { LeftPaneInboxHelper } from '../../../components/leftPane/LeftPaneInboxHelper'; describe('LeftPaneInboxHelper', () => { const defaultProps: LeftPaneInboxPropsType = { diff --git a/ts/test-node/components/leftPane/getConversationInDirection_test.ts b/ts/test-node/components/leftPane/getConversationInDirection_test.ts index d489f72ef..27512f0cf 100644 --- a/ts/test-node/components/leftPane/getConversationInDirection_test.ts +++ b/ts/test-node/components/leftPane/getConversationInDirection_test.ts @@ -2,10 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { assert } from 'chai'; -import { - FindDirection, - ToFindType, -} from '../../../components/leftPane/LeftPaneHelper'; +import type { ToFindType } from '../../../components/leftPane/LeftPaneHelper'; +import { FindDirection } from '../../../components/leftPane/LeftPaneHelper'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; import { getConversationInDirection } from '../../../components/leftPane/getConversationInDirection'; diff --git a/ts/test-node/components/media-gallery/groupMessagesByDate_test.ts b/ts/test-node/components/media-gallery/groupMessagesByDate_test.ts index ed91604f0..076e5a252 100644 --- a/ts/test-node/components/media-gallery/groupMessagesByDate_test.ts +++ b/ts/test-node/components/media-gallery/groupMessagesByDate_test.ts @@ -5,11 +5,9 @@ import { assert } from 'chai'; import { shuffle } from 'lodash'; import { IMAGE_JPEG } from '../../../types/MIME'; -import { - groupMediaItemsByDate, - Section, -} from '../../../components/conversation/media-gallery/groupMediaItemsByDate'; -import { MediaItemType } from '../../../types/MediaItem'; +import type { Section } from '../../../components/conversation/media-gallery/groupMediaItemsByDate'; +import { groupMediaItemsByDate } from '../../../components/conversation/media-gallery/groupMediaItemsByDate'; +import type { MediaItemType } from '../../../types/MediaItem'; import { fakeAttachment } from '../../../test-both/helpers/fakeAttachment'; const testDate = ( diff --git a/ts/test-node/jobs/JobQueueDatabaseStore_test.ts b/ts/test-node/jobs/JobQueueDatabaseStore_test.ts index aab2d9d48..87c477f7a 100644 --- a/ts/test-node/jobs/JobQueueDatabaseStore_test.ts +++ b/ts/test-node/jobs/JobQueueDatabaseStore_test.ts @@ -4,7 +4,7 @@ import { assert } from 'chai'; import * as sinon from 'sinon'; import { noop } from 'lodash'; -import { StoredJob } from '../../jobs/types'; +import type { StoredJob } from '../../jobs/types'; import { JobQueueDatabaseStore } from '../../jobs/JobQueueDatabaseStore'; diff --git a/ts/test-node/jobs/JobQueue_test.ts b/ts/test-node/jobs/JobQueue_test.ts index 59d8163f7..166737024 100644 --- a/ts/test-node/jobs/JobQueue_test.ts +++ b/ts/test-node/jobs/JobQueue_test.ts @@ -16,7 +16,7 @@ import { assertRejects } from '../helpers'; import type { LoggerType } from '../../types/Logging'; import { JobQueue } from '../../jobs/JobQueue'; -import { ParsedJob, StoredJob, JobQueueStore } from '../../jobs/types'; +import type { ParsedJob, StoredJob, JobQueueStore } from '../../jobs/types'; describe('JobQueue', () => { describe('end-to-end tests', () => { diff --git a/ts/test-node/jobs/TestJobQueueStore.ts b/ts/test-node/jobs/TestJobQueueStore.ts index 8f4980a70..d52f3623e 100644 --- a/ts/test-node/jobs/TestJobQueueStore.ts +++ b/ts/test-node/jobs/TestJobQueueStore.ts @@ -6,7 +6,7 @@ import EventEmitter, { once } from 'events'; -import { JobQueueStore, StoredJob } from '../../jobs/types'; +import type { JobQueueStore, StoredJob } from '../../jobs/types'; import { sleep } from '../../util/sleep'; export class TestJobQueueStore implements JobQueueStore { diff --git a/ts/test-node/quill/memberRepository_test.ts b/ts/test-node/quill/memberRepository_test.ts index 616772b08..35fba40c9 100644 --- a/ts/test-node/quill/memberRepository_test.ts +++ b/ts/test-node/quill/memberRepository_test.ts @@ -3,7 +3,7 @@ import { assert } from 'chai'; -import { ConversationType } from '../../state/ducks/conversations'; +import type { ConversationType } from '../../state/ducks/conversations'; import { MemberRepository } from '../../quill/memberRepository'; import { getDefaultConversation } from '../../test-both/helpers/getDefaultConversation'; diff --git a/ts/test-node/quill/mentions/matchers_test.ts b/ts/test-node/quill/mentions/matchers_test.ts index dd48dfcae..07bf89947 100644 --- a/ts/test-node/quill/mentions/matchers_test.ts +++ b/ts/test-node/quill/mentions/matchers_test.ts @@ -2,12 +2,12 @@ // SPDX-License-Identifier: AGPL-3.0-only import { assert } from 'chai'; -import { RefObject } from 'react'; +import type { RefObject } from 'react'; import Delta from 'quill-delta'; import { matchMention } from '../../../quill/mentions/matchers'; import { MemberRepository } from '../../../quill/memberRepository'; -import { ConversationType } from '../../../state/ducks/conversations'; +import type { ConversationType } from '../../../state/ducks/conversations'; import { getDefaultConversation } from '../../../test-both/helpers/getDefaultConversation'; class FakeTokenList extends Array { diff --git a/ts/test-node/sql_migrations_test.ts b/ts/test-node/sql_migrations_test.ts index afb1581f4..fa47e9c1a 100644 --- a/ts/test-node/sql_migrations_test.ts +++ b/ts/test-node/sql_migrations_test.ts @@ -2,7 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { assert } from 'chai'; -import SQL, { Database } from 'better-sqlite3'; +import type { Database } from 'better-sqlite3'; +import SQL from 'better-sqlite3'; import { v4 as generateGuid } from 'uuid'; import { SCHEMA_VERSIONS } from '../sql/Server'; diff --git a/ts/test-node/types/EmbeddedContact_test.ts b/ts/test-node/types/EmbeddedContact_test.ts index 01abf1c8f..37162d3c9 100644 --- a/ts/test-node/types/EmbeddedContact_test.ts +++ b/ts/test-node/types/EmbeddedContact_test.ts @@ -5,11 +5,9 @@ import { assert } from 'chai'; import * as sinon from 'sinon'; import { IMAGE_GIF, IMAGE_PNG } from '../../types/MIME'; -import { MessageAttributesType } from '../../model-types.d'; +import type { MessageAttributesType } from '../../model-types.d'; +import type { Avatar, Email, Phone } from '../../types/EmbeddedContact'; import { - Avatar, - Email, - Phone, _validate, embeddedContactSelector, getName, diff --git a/ts/test-node/types/message/initializeAttachmentMetadata_test.ts b/ts/test-node/types/message/initializeAttachmentMetadata_test.ts index 479ade56f..bb6c39c6f 100644 --- a/ts/test-node/types/message/initializeAttachmentMetadata_test.ts +++ b/ts/test-node/types/message/initializeAttachmentMetadata_test.ts @@ -4,7 +4,7 @@ import { assert } from 'chai'; import * as Message from '../../../types/message/initializeAttachmentMetadata'; -import { IncomingMessage } from '../../../types/Message'; +import type { IncomingMessage } from '../../../types/Message'; import { SignalService } from '../../../protobuf'; import * as MIME from '../../../types/MIME'; import * as Bytes from '../../../Bytes'; diff --git a/ts/test-node/util/sgnlHref_test.ts b/ts/test-node/util/sgnlHref_test.ts index 2373edaf1..1903008f7 100644 --- a/ts/test-node/util/sgnlHref_test.ts +++ b/ts/test-node/util/sgnlHref_test.ts @@ -3,7 +3,7 @@ import { assert } from 'chai'; import Sinon from 'sinon'; -import { LoggerType } from '../../types/Logging'; +import type { LoggerType } from '../../types/Logging'; import { isSgnlHref, diff --git a/ts/test-node/util/toggleMaximizedBrowserWindow_test.ts b/ts/test-node/util/toggleMaximizedBrowserWindow_test.ts index 8119c81c5..8594a8728 100644 --- a/ts/test-node/util/toggleMaximizedBrowserWindow_test.ts +++ b/ts/test-node/util/toggleMaximizedBrowserWindow_test.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as sinon from 'sinon'; -import { BrowserWindow } from 'electron'; +import type { BrowserWindow } from 'electron'; import { toggleMaximizedBrowserWindow } from '../../util/toggleMaximizedBrowserWindow'; diff --git a/ts/textsecure/AccountManager.ts b/ts/textsecure/AccountManager.ts index f98311e97..7d85b4ef9 100644 --- a/ts/textsecure/AccountManager.ts +++ b/ts/textsecure/AccountManager.ts @@ -12,9 +12,9 @@ import { omit } from 'lodash'; import EventTarget from './EventTarget'; import type { WebAPIType } from './WebAPI'; import { HTTPError } from './Errors'; -import { KeyPairType, CompatSignedPreKeyType } from './Types.d'; +import type { KeyPairType, CompatSignedPreKeyType } from './Types.d'; import ProvisioningCipher from './ProvisioningCipher'; -import { IncomingWebSocketRequest } from './WebsocketResources'; +import type { IncomingWebSocketRequest } from './WebsocketResources'; import createTaskWithTimeout from './TaskWithTimeout'; import * as Bytes from '../Bytes'; import { RemoveAllConfiguration } from '../types/RemoveAllConfiguration'; diff --git a/ts/textsecure/MessageReceiver.ts b/ts/textsecure/MessageReceiver.ts index 9b6e8a4bd..c9b5996b2 100644 --- a/ts/textsecure/MessageReceiver.ts +++ b/ts/textsecure/MessageReceiver.ts @@ -9,6 +9,11 @@ import { isNumber, map } from 'lodash'; import PQueue from 'p-queue'; import { v4 as getGuid } from 'uuid'; +import type { + SealedSenderDecryptionResult, + SenderCertificate, + UnidentifiedSenderMessageContent, +} from '@signalapp/signal-client'; import { DecryptionErrorMessage, groupDecrypt, @@ -17,15 +22,12 @@ import { processSenderKeyDistributionMessage, ProtocolAddress, PublicKey, - SealedSenderDecryptionResult, sealedSenderDecryptMessage, sealedSenderDecryptToUsmc, - SenderCertificate, SenderKeyDistributionMessage, signalDecrypt, signalDecryptPreKey, SignalMessage, - UnidentifiedSenderMessageContent, } from '@signalapp/signal-client'; import { @@ -37,43 +39,45 @@ import { } from '../LibSignalStores'; import { verifySignature } from '../Curve'; import { strictAssert } from '../util/assert'; -import { BatcherType, createBatcher } from '../util/batcher'; +import type { BatcherType } from '../util/batcher'; +import { createBatcher } from '../util/batcher'; import { dropNull } from '../util/dropNull'; import { normalizeUuid } from '../util/normalizeUuid'; import { normalizeNumber } from '../util/normalizeNumber'; import { parseIntOrThrow } from '../util/parseIntOrThrow'; import { Zone } from '../util/Zone'; import { deriveMasterKeyFromGroupV1 } from '../Crypto'; -import { DownloadedAttachmentType } from '../types/Attachment'; +import type { DownloadedAttachmentType } from '../types/Attachment'; import { Address } from '../types/Address'; import { QualifiedAddress } from '../types/QualifiedAddress'; import { UUID } from '../types/UUID'; import * as Errors from '../types/errors'; import { SignalService as Proto } from '../protobuf'; -import { UnprocessedType } from '../textsecure.d'; +import type { UnprocessedType } from '../textsecure.d'; import { deriveGroupFields, MASTER_KEY_LENGTH } from '../groups'; import createTaskWithTimeout from './TaskWithTimeout'; import { processAttachment, processDataMessage } from './processDataMessage'; import { processSyncMessage } from './processSyncMessage'; -import EventTarget, { EventHandler } from './EventTarget'; +import type { EventHandler } from './EventTarget'; +import EventTarget from './EventTarget'; import { downloadAttachment } from './downloadAttachment'; -import { IncomingWebSocketRequest } from './WebsocketResources'; +import type { IncomingWebSocketRequest } from './WebsocketResources'; import { ContactBuffer, GroupBuffer } from './ContactsParser'; import type { WebAPIType } from './WebAPI'; import type { Storage } from './Storage'; import { WarnOnlyError } from './Errors'; import * as Bytes from '../Bytes'; -import { +import type { ProcessedDataMessage, ProcessedSyncMessage, ProcessedSent, ProcessedEnvelope, IRequestHandler, } from './Types.d'; +import type { ReconnectEvent, EnvelopeEvent } from './messageReceiverEvents'; import { - ReconnectEvent, EmptyEvent, ProgressEvent, TypingEvent, @@ -99,7 +103,6 @@ import { ContactSyncEvent, GroupEvent, GroupSyncEvent, - EnvelopeEvent, } from './messageReceiverEvents'; import * as log from '../logging/log'; diff --git a/ts/textsecure/OutgoingMessage.ts b/ts/textsecure/OutgoingMessage.ts index 4e16a85e8..98ba9c2c6 100644 --- a/ts/textsecure/OutgoingMessage.ts +++ b/ts/textsecure/OutgoingMessage.ts @@ -10,10 +10,12 @@ import { reject } from 'lodash'; import { z } from 'zod'; -import { - CiphertextMessageType, +import type { CiphertextMessage, PlaintextContent, +} from '@signalapp/signal-client'; +import { + CiphertextMessageType, ProtocolAddress, sealedSenderEncrypt, SenderCertificate, @@ -22,7 +24,7 @@ import { } from '@signalapp/signal-client'; import type { WebAPIType, MessageType } from './WebAPI'; -import { SendMetadataType, SendOptionsType } from './SendMessage'; +import type { SendMetadataType, SendOptionsType } from './SendMessage'; import { OutgoingIdentityKeyError, OutgoingMessageError, @@ -31,7 +33,7 @@ import { UnregisteredUserError, HTTPError, } from './Errors'; -import { CallbackResultType, CustomError } from './Types.d'; +import type { CallbackResultType, CustomError } from './Types.d'; import { isValidNumber } from '../types/PhoneNumber'; import { Address } from '../types/Address'; import { QualifiedAddress } from '../types/QualifiedAddress'; diff --git a/ts/textsecure/ProvisioningCipher.ts b/ts/textsecure/ProvisioningCipher.ts index 9a7a26c76..841c4e707 100644 --- a/ts/textsecure/ProvisioningCipher.ts +++ b/ts/textsecure/ProvisioningCipher.ts @@ -4,7 +4,7 @@ /* eslint-disable more/no-then */ /* eslint-disable max-classes-per-file */ -import { KeyPairType } from './Types.d'; +import type { KeyPairType } from './Types.d'; import * as Bytes from '../Bytes'; import { decryptAes256CbcPkcsPadding, diff --git a/ts/textsecure/SendMessage.ts b/ts/textsecure/SendMessage.ts index b15dcf7de..bd0d03405 100644 --- a/ts/textsecure/SendMessage.ts +++ b/ts/textsecure/SendMessage.ts @@ -7,11 +7,11 @@ /* eslint-disable no-bitwise */ /* eslint-disable max-classes-per-file */ -import { Dictionary } from 'lodash'; +import type { Dictionary } from 'lodash'; import Long from 'long'; import PQueue from 'p-queue'; +import type { PlaintextContent } from '@signalapp/signal-client'; import { - PlaintextContent, ProtocolAddress, SenderKeyDistributionMessage, } from '@signalapp/signal-client'; @@ -23,8 +23,8 @@ import { QualifiedAddress } from '../types/QualifiedAddress'; import { SenderKeys } from '../LibSignalStores'; import type { LinkPreviewType } from '../types/message/LinkPreviews'; import { MIMETypeToString } from '../types/MIME'; -import * as Attachment from '../types/Attachment'; -import { +import type * as Attachment from '../types/Attachment'; +import type { ChallengeType, GroupCredentialsType, GroupLogResponseType, @@ -35,14 +35,15 @@ import { WebAPIType, } from './WebAPI'; import createTaskWithTimeout from './TaskWithTimeout'; -import { CallbackResultType } from './Types.d'; -import OutgoingMessage, { +import type { CallbackResultType } from './Types.d'; +import type { SerializedCertificateType, SendLogCallbackType, } from './OutgoingMessage'; +import OutgoingMessage from './OutgoingMessage'; import * as Bytes from '../Bytes'; import { getRandomBytes, getZeroes, encryptAttachment } from '../Crypto'; -import { +import type { StorageServiceCallOptionsType, StorageServiceCredentials, } from '../textsecure.d'; @@ -52,17 +53,14 @@ import { SendMessageProtoError, HTTPError, } from './Errors'; -import { BodyRangesType } from '../types/Util'; -import { +import type { BodyRangesType } from '../types/Util'; +import type { LinkPreviewImage, LinkPreviewMetadata, } from '../linkPreviews/linkPreviewFetch'; import { concat, isEmpty, map } from '../util/iterables'; -import { - handleMessageSend, - shouldSaveProto, - SendTypesType, -} from '../util/handleMessageSend'; +import type { SendTypesType } from '../util/handleMessageSend'; +import { handleMessageSend, shouldSaveProto } from '../util/handleMessageSend'; import { SignalService as Proto } from '../protobuf'; import * as log from '../logging/log'; diff --git a/ts/textsecure/SocketManager.ts b/ts/textsecure/SocketManager.ts index e06a33254..fc2be385f 100644 --- a/ts/textsecure/SocketManager.ts +++ b/ts/textsecure/SocketManager.ts @@ -3,7 +3,8 @@ import URL from 'url'; import ProxyAgent from 'proxy-agent'; -import { RequestInit, Response, Headers } from 'node-fetch'; +import type { RequestInit } from 'node-fetch'; +import { Response, Headers } from 'node-fetch'; import { client as WebSocketClient } from 'websocket'; import qs from 'querystring'; import EventListener from 'events'; @@ -21,13 +22,14 @@ import * as Bytes from '../Bytes'; import * as Timers from '../Timers'; import * as log from '../logging/log'; -import WebSocketResource, { +import type { WebSocketResourceOptions, IncomingWebSocketRequest, } from './WebsocketResources'; +import WebSocketResource from './WebsocketResources'; import { ConnectTimeoutError, HTTPError } from './Errors'; import { handleStatusCode, translateError } from './Utils'; -import { WebAPICredentials, IRequestHandler } from './Types.d'; +import type { WebAPICredentials, IRequestHandler } from './Types.d'; const TEN_SECONDS = 10 * durations.SECOND; diff --git a/ts/textsecure/Storage.ts b/ts/textsecure/Storage.ts index 0ed1c34d6..4470d44ba 100644 --- a/ts/textsecure/Storage.ts +++ b/ts/textsecure/Storage.ts @@ -1,7 +1,7 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { +import type { StorageAccessType as Access, StorageInterface, } from '../types/Storage.d'; @@ -10,7 +10,7 @@ import { Blocked } from './storage/Blocked'; import { assert } from '../util/assert'; import Data from '../sql/Client'; -import { SignalProtocolStore } from '../SignalProtocolStore'; +import type { SignalProtocolStore } from '../SignalProtocolStore'; import * as log from '../logging/log'; export class Storage implements StorageInterface { diff --git a/ts/textsecure/SyncRequest.ts b/ts/textsecure/SyncRequest.ts index 81b8e405e..cf396062f 100644 --- a/ts/textsecure/SyncRequest.ts +++ b/ts/textsecure/SyncRequest.ts @@ -6,9 +6,10 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable max-classes-per-file */ -import EventTarget, { EventHandler } from './EventTarget'; +import type { EventHandler } from './EventTarget'; +import EventTarget from './EventTarget'; import MessageReceiver from './MessageReceiver'; -import { ContactSyncEvent, GroupSyncEvent } from './messageReceiverEvents'; +import type { ContactSyncEvent, GroupSyncEvent } from './messageReceiverEvents'; import MessageSender from './SendMessage'; import { assert } from '../util/assert'; import { getSendOptions } from '../util/getSendOptions'; diff --git a/ts/textsecure/Utils.ts b/ts/textsecure/Utils.ts index f2f18f205..d70b88f49 100644 --- a/ts/textsecure/Utils.ts +++ b/ts/textsecure/Utils.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as log from '../logging/log'; -import { HTTPError } from './Errors'; +import type { HTTPError } from './Errors'; export async function handleStatusCode(status: number): Promise { if (status === 499) { diff --git a/ts/textsecure/WebAPI.ts b/ts/textsecure/WebAPI.ts index 08b012832..789b2e60a 100644 --- a/ts/textsecure/WebAPI.ts +++ b/ts/textsecure/WebAPI.ts @@ -8,18 +8,13 @@ /* eslint-disable no-nested-ternary */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import fetch, { Response } from 'node-fetch'; +import type { Response } from 'node-fetch'; +import fetch from 'node-fetch'; import ProxyAgent from 'proxy-agent'; import { Agent } from 'https'; import pProps from 'p-props'; -import { - compact, - Dictionary, - escapeRegExp, - isNumber, - mapValues, - zipObject, -} from 'lodash'; +import type { Dictionary } from 'lodash'; +import { compact, escapeRegExp, isNumber, mapValues, zipObject } from 'lodash'; import { createVerify } from 'crypto'; import { pki } from 'node-forge'; import is from '@sindresorhus/is'; @@ -32,7 +27,7 @@ import { assert } from '../util/assert'; import * as durations from '../util/durations'; import { getUserAgent } from '../util/getUserAgent'; import { toWebSafeBase64 } from '../util/webSafeBase64'; -import { SocketStatus } from '../types/SocketStatus'; +import type { SocketStatus } from '../types/SocketStatus'; import { toLogFormat } from '../types/errors'; import { isPackIdValid, redactPackId } from '../types/Stickers'; import * as Bytes from '../Bytes'; @@ -47,17 +42,17 @@ import { import { calculateAgreement, generateKeyPair } from '../Curve'; import * as linkPreviewFetch from '../linkPreviews/linkPreviewFetch'; -import { +import type { StorageServiceCallOptionsType, StorageServiceCredentials, } from '../textsecure.d'; import { SocketManager } from './SocketManager'; -import WebSocketResource from './WebsocketResources'; +import type WebSocketResource from './WebsocketResources'; import { SignalService as Proto } from '../protobuf'; import { HTTPError } from './Errors'; -import MessageSender from './SendMessage'; -import { WebAPICredentials, IRequestHandler } from './Types.d'; +import type MessageSender from './SendMessage'; +import type { WebAPICredentials, IRequestHandler } from './Types.d'; import { handleStatusCode, translateError } from './Utils'; import * as log from '../logging/log'; diff --git a/ts/textsecure/WebsocketResources.ts b/ts/textsecure/WebsocketResources.ts index caa58f4d7..ce522c755 100644 --- a/ts/textsecure/WebsocketResources.ts +++ b/ts/textsecure/WebsocketResources.ts @@ -23,9 +23,10 @@ * */ -import { connection as WebSocket, IMessage } from 'websocket'; +import type { connection as WebSocket, IMessage } from 'websocket'; -import EventTarget, { EventHandler } from './EventTarget'; +import type { EventHandler } from './EventTarget'; +import EventTarget from './EventTarget'; import * as durations from '../util/durations'; import { dropNull } from '../util/dropNull'; diff --git a/ts/textsecure/downloadAttachment.ts b/ts/textsecure/downloadAttachment.ts index 984ed60bb..7b30c9c7a 100644 --- a/ts/textsecure/downloadAttachment.ts +++ b/ts/textsecure/downloadAttachment.ts @@ -5,12 +5,12 @@ import { isNumber, omit } from 'lodash'; import { strictAssert } from '../util/assert'; import { dropNull } from '../util/dropNull'; -import { DownloadedAttachmentType } from '../types/Attachment'; +import type { DownloadedAttachmentType } from '../types/Attachment'; import * as MIME from '../types/MIME'; import * as Bytes from '../Bytes'; import { getFirstBytes, decryptAttachment } from '../Crypto'; -import { ProcessedAttachment } from './Types.d'; +import type { ProcessedAttachment } from './Types.d'; import type { WebAPIType } from './WebAPI'; export async function downloadAttachment( diff --git a/ts/textsecure/getKeysForIdentifier.ts b/ts/textsecure/getKeysForIdentifier.ts index 71e544dff..a54106de6 100644 --- a/ts/textsecure/getKeysForIdentifier.ts +++ b/ts/textsecure/getKeysForIdentifier.ts @@ -13,7 +13,7 @@ import { Sessions, IdentityKeys } from '../LibSignalStores'; import { Address } from '../types/Address'; import { QualifiedAddress } from '../types/QualifiedAddress'; import { UUID } from '../types/UUID'; -import { ServerKeysType, WebAPIType } from './WebAPI'; +import type { ServerKeysType, WebAPIType } from './WebAPI'; import * as log from '../logging/log'; export async function getKeysForIdentifier( diff --git a/ts/textsecure/messageReceiverEvents.ts b/ts/textsecure/messageReceiverEvents.ts index f0f723d3f..ea90d6839 100644 --- a/ts/textsecure/messageReceiverEvents.ts +++ b/ts/textsecure/messageReceiverEvents.ts @@ -2,10 +2,10 @@ // SPDX-License-Identifier: AGPL-3.0-only /* eslint-disable max-classes-per-file */ -import { PublicKey } from '@signalapp/signal-client'; +import type { PublicKey } from '@signalapp/signal-client'; -import { SignalService as Proto } from '../protobuf'; -import { +import type { SignalService as Proto } from '../protobuf'; +import type { ProcessedEnvelope, ProcessedDataMessage, ProcessedSent, diff --git a/ts/textsecure/processDataMessage.ts b/ts/textsecure/processDataMessage.ts index 562708d62..3364a3c4e 100644 --- a/ts/textsecure/processDataMessage.ts +++ b/ts/textsecure/processDataMessage.ts @@ -11,7 +11,7 @@ import { deriveGroupFields } from '../groups'; import * as Bytes from '../Bytes'; import { deriveMasterKeyFromGroupV1 } from '../Crypto'; -import { +import type { ProcessedAttachment, ProcessedDataMessage, ProcessedGroupContext, diff --git a/ts/textsecure/processSyncMessage.ts b/ts/textsecure/processSyncMessage.ts index 3a111094a..71ef42e5c 100644 --- a/ts/textsecure/processSyncMessage.ts +++ b/ts/textsecure/processSyncMessage.ts @@ -3,7 +3,7 @@ import { SignalService as Proto } from '../protobuf'; import { normalizeUuid } from '../util/normalizeUuid'; -import { +import type { ProcessedUnidentifiedDeliveryStatus, ProcessedSent, ProcessedSyncMessage, diff --git a/ts/textsecure/storage/Blocked.ts b/ts/textsecure/storage/Blocked.ts index c9bd528f0..7e9b8f904 100644 --- a/ts/textsecure/storage/Blocked.ts +++ b/ts/textsecure/storage/Blocked.ts @@ -3,7 +3,7 @@ import { without } from 'lodash'; -import { StorageInterface } from '../../types/Storage.d'; +import type { StorageInterface } from '../../types/Storage.d'; import * as log from '../../logging/log'; const BLOCKED_NUMBERS_ID = 'blocked'; diff --git a/ts/textsecure/storage/User.ts b/ts/textsecure/storage/User.ts index 97a2ae0fb..6f490a9e6 100644 --- a/ts/textsecure/storage/User.ts +++ b/ts/textsecure/storage/User.ts @@ -1,10 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { WebAPICredentials } from '../Types.d'; +import type { WebAPICredentials } from '../Types.d'; import { strictAssert } from '../../util/assert'; -import { StorageInterface } from '../../types/Storage.d'; +import type { StorageInterface } from '../../types/Storage.d'; import { UUID } from '../../types/UUID'; import * as log from '../../logging/log'; diff --git a/ts/types/Address.ts b/ts/types/Address.ts index 0497a24c7..ed0ffa9fc 100644 --- a/ts/types/Address.ts +++ b/ts/types/Address.ts @@ -3,7 +3,8 @@ import { strictAssert } from '../util/assert'; -import { UUID, UUIDStringType } from './UUID'; +import type { UUIDStringType } from './UUID'; +import { UUID } from './UUID'; export type AddressStringType = `${UUIDStringType}.${number}`; diff --git a/ts/types/Attachment.ts b/ts/types/Attachment.ts index b2155f4df..79d14d625 100644 --- a/ts/types/Attachment.ts +++ b/ts/types/Attachment.ts @@ -13,7 +13,7 @@ import { } from 'lodash'; import { blobToArrayBuffer } from 'blob-util'; -import { LoggerType } from './Logging'; +import type { LoggerType } from './Logging'; import * as MIME from './MIME'; import { toLogFormat } from './errors'; import { SignalService } from '../protobuf'; @@ -21,7 +21,8 @@ import { isImageTypeSupported, isVideoTypeSupported, } from '../util/GoogleChrome'; -import { LocalizerType, ThemeType } from './Util'; +import type { LocalizerType } from './Util'; +import { ThemeType } from './Util'; import * as GoogleChrome from '../util/GoogleChrome'; import { scaleImageToLevel } from '../util/scaleImageToLevel'; diff --git a/ts/types/Audio.tsx b/ts/types/Audio.tsx index 133203999..3a911bd1b 100644 --- a/ts/types/Audio.tsx +++ b/ts/types/Audio.tsx @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import LRU from 'lru-cache'; +import type LRU from 'lru-cache'; export type WaveformCache = LRU< string, diff --git a/ts/types/Avatar.ts b/ts/types/Avatar.ts index 73b4016ba..eadd7da9f 100644 --- a/ts/types/Avatar.ts +++ b/ts/types/Avatar.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AvatarColorType } from './Colors'; +import type { AvatarColorType } from './Colors'; import { strictAssert } from '../util/assert'; export const PersonalAvatarIcons = [ diff --git a/ts/types/Conversation.ts b/ts/types/Conversation.ts index 07695ead5..9f541d2cf 100644 --- a/ts/types/Conversation.ts +++ b/ts/types/Conversation.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { computeHash } from '../Crypto'; -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; export type BuildAvatarUpdaterOptions = Readonly<{ deleteAttachmentData: (path: string) => Promise; diff --git a/ts/types/EmbeddedContact.ts b/ts/types/EmbeddedContact.ts index 0797dfd94..423575b1b 100644 --- a/ts/types/EmbeddedContact.ts +++ b/ts/types/EmbeddedContact.ts @@ -4,16 +4,16 @@ import { omit } from 'lodash'; import { SignalService as Proto } from '../protobuf'; -import { MessageAttributesType } from '../model-types.d'; +import type { MessageAttributesType } from '../model-types.d'; import { isNotNil } from '../util/isNotNil'; import { format as formatPhoneNumber, parse as parsePhoneNumber, } from './PhoneNumber'; -import { AttachmentType, migrateDataToFileSystem } from './Attachment'; +import type { AttachmentType, migrateDataToFileSystem } from './Attachment'; import { toLogFormat } from './errors'; -import { LoggerType } from './Logging'; +import type { LoggerType } from './Logging'; export type EmbeddedContactType = { name?: Name; diff --git a/ts/types/I18N.ts b/ts/types/I18N.ts index eaf254226..8e7f468ad 100644 --- a/ts/types/I18N.ts +++ b/ts/types/I18N.ts @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LocalizerType } from './Util'; +import type { LocalizerType } from './Util'; export type LocaleMessagesType = { [key: string]: { diff --git a/ts/types/LinkPreview.ts b/ts/types/LinkPreview.ts index e41a4df8b..f97c96c3f 100644 --- a/ts/types/LinkPreview.ts +++ b/ts/types/LinkPreview.ts @@ -8,7 +8,7 @@ import LinkifyIt from 'linkify-it'; import { maybeParseUrl } from '../util/url'; import { replaceEmojiWithSpaces } from '../util/emoji'; -import { AttachmentType } from './Attachment'; +import type { AttachmentType } from './Attachment'; export type LinkPreviewImage = AttachmentType & { data: Uint8Array; diff --git a/ts/types/MediaItem.ts b/ts/types/MediaItem.ts index 812f52991..a90f73452 100644 --- a/ts/types/MediaItem.ts +++ b/ts/types/MediaItem.ts @@ -1,8 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AttachmentType } from './Attachment'; -import { MIMEType } from './MIME'; +import type { AttachmentType } from './Attachment'; +import type { MIMEType } from './MIME'; export type MessageAttributesType = { attachments: Array; diff --git a/ts/types/Message.ts b/ts/types/Message.ts index cbc3f9928..f92a37fc0 100644 --- a/ts/types/Message.ts +++ b/ts/types/Message.ts @@ -3,9 +3,9 @@ /* eslint-disable camelcase */ -import { AttachmentType } from './Attachment'; -import { EmbeddedContactType } from './EmbeddedContact'; -import { IndexableBoolean, IndexablePresence } from './IndexedDB'; +import type { AttachmentType } from './Attachment'; +import type { EmbeddedContactType } from './EmbeddedContact'; +import type { IndexableBoolean, IndexablePresence } from './IndexedDB'; export type Message = ( | UserMessage diff --git a/ts/types/QualifiedAddress.ts b/ts/types/QualifiedAddress.ts index e229e6440..c590c7d09 100644 --- a/ts/types/QualifiedAddress.ts +++ b/ts/types/QualifiedAddress.ts @@ -3,8 +3,10 @@ import { strictAssert } from '../util/assert'; -import { UUID, UUIDStringType } from './UUID'; -import { Address, AddressStringType } from './Address'; +import type { UUIDStringType } from './UUID'; +import { UUID } from './UUID'; +import type { AddressStringType } from './Address'; +import { Address } from './Address'; const QUALIFIED_ADDRESS_REGEXP = /^([0-9a-f-]+):([0-9a-f-]+).(\d+)$/i; diff --git a/ts/types/Stickers.ts b/ts/types/Stickers.ts index 1ee39184e..54b9f60cd 100644 --- a/ts/types/Stickers.ts +++ b/ts/types/Stickers.ts @@ -11,7 +11,8 @@ import { makeLookup } from '../util/makeLookup'; import { maybeParseUrl } from '../util/url'; import * as Bytes from '../Bytes'; import { deriveStickerPackKey, decryptAttachment } from '../Crypto'; -import { IMAGE_WEBP, MIMEType } from './MIME'; +import type { MIMEType } from './MIME'; +import { IMAGE_WEBP } from './MIME'; import { sniffImageMimeType } from '../util/sniffImageMimeType'; import type { AttachmentType } from './Attachment'; import type { diff --git a/ts/types/StorageUIKeys.ts b/ts/types/StorageUIKeys.ts index 24a50dcc4..e8f6c1345 100644 --- a/ts/types/StorageUIKeys.ts +++ b/ts/types/StorageUIKeys.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { StorageAccessType } from './Storage.d'; +import type { StorageAccessType } from './Storage.d'; // Configuration keys that only affect UI export const STORAGE_UI_KEYS: ReadonlyArray = [ diff --git a/ts/types/VisualAttachment.ts b/ts/types/VisualAttachment.ts index 54396aab4..bc77c5c03 100644 --- a/ts/types/VisualAttachment.ts +++ b/ts/types/VisualAttachment.ts @@ -4,8 +4,9 @@ import loadImage from 'blueimp-load-image'; import { blobToArrayBuffer } from 'blob-util'; import { toLogFormat } from './errors'; -import { MIMEType, IMAGE_PNG } from './MIME'; -import { LoggerType } from './Logging'; +import type { MIMEType } from './MIME'; +import { IMAGE_PNG } from './MIME'; +import type { LoggerType } from './Logging'; import { arrayBufferToObjectURL } from '../util/arrayBufferToObjectURL'; import { strictAssert } from '../util/assert'; import { canvasToBlob } from '../util/canvasToBlob'; diff --git a/ts/types/message/LinkPreviews.ts b/ts/types/message/LinkPreviews.ts index 469d7eb80..cc74c8ca3 100644 --- a/ts/types/message/LinkPreviews.ts +++ b/ts/types/message/LinkPreviews.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AttachmentType } from '../Attachment'; +import type { AttachmentType } from '../Attachment'; export type LinkPreviewType = { title: string; diff --git a/ts/types/message/initializeAttachmentMetadata.ts b/ts/types/message/initializeAttachmentMetadata.ts index 96e108bb1..1916cd12b 100644 --- a/ts/types/message/initializeAttachmentMetadata.ts +++ b/ts/types/message/initializeAttachmentMetadata.ts @@ -3,7 +3,7 @@ import * as Attachment from '../Attachment'; import * as IndexedDB from '../IndexedDB'; -import { Message, UserMessage } from '../Message'; +import type { Message, UserMessage } from '../Message'; const hasAttachment = ( predicate: (value: Attachment.AttachmentType) => boolean diff --git a/ts/updater/common.ts b/ts/updater/common.ts index 46631791f..65b91609b 100644 --- a/ts/updater/common.ts +++ b/ts/updater/common.ts @@ -11,17 +11,20 @@ import { join, normalize } from 'path'; import { tmpdir } from 'os'; import { throttle } from 'lodash'; -import { createParser, ParserConfiguration } from 'dashdash'; +import type { ParserConfiguration } from 'dashdash'; +import { createParser } from 'dashdash'; import ProxyAgent from 'proxy-agent'; import { FAILSAFE_SCHEMA, safeLoad } from 'js-yaml'; import { gt } from 'semver'; import config from 'config'; -import got, { StrictOptions as GotOptions } from 'got'; +import type { StrictOptions as GotOptions } from 'got'; +import got from 'got'; import { v4 as getGuid } from 'uuid'; import pify from 'pify'; import mkdirp from 'mkdirp'; import rimraf from 'rimraf'; -import { app, BrowserWindow, ipcMain } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { app, ipcMain } from 'electron'; import { getTempPath } from '../../app/attachments'; import { DialogType } from '../types/Dialogs'; @@ -32,7 +35,7 @@ import * as packageJson from '../../package.json'; import { getSignatureFileName } from './signature'; import { isPathInside } from '../util/isPathInside'; -import { LoggerType } from '../types/Logging'; +import type { LoggerType } from '../types/Logging'; const writeFile = pify(writeFileCallback); const mkdirpPromise = pify(mkdirp); diff --git a/ts/updater/index.ts b/ts/updater/index.ts index 19469f26c..e0cc40f30 100644 --- a/ts/updater/index.ts +++ b/ts/updater/index.ts @@ -2,12 +2,12 @@ // SPDX-License-Identifier: AGPL-3.0-only import config from 'config'; -import { BrowserWindow } from 'electron'; +import type { BrowserWindow } from 'electron'; -import { UpdaterInterface } from './common'; +import type { UpdaterInterface } from './common'; import { start as startMacOS } from './macos'; import { start as startWindows } from './windows'; -import { LoggerType } from '../types/Logging'; +import type { LoggerType } from '../types/Logging'; let initialized = false; diff --git a/ts/updater/macos.ts b/ts/updater/macos.ts index 2a92d8039..b9dd22da0 100644 --- a/ts/updater/macos.ts +++ b/ts/updater/macos.ts @@ -2,16 +2,19 @@ // SPDX-License-Identifier: AGPL-3.0-only import { createReadStream, statSync } from 'fs'; -import { createServer, IncomingMessage, Server, ServerResponse } from 'http'; -import { AddressInfo } from 'net'; +import type { IncomingMessage, Server, ServerResponse } from 'http'; +import { createServer } from 'http'; +import type { AddressInfo } from 'net'; import { dirname } from 'path'; import { v4 as getGuid } from 'uuid'; -import { app, autoUpdater, BrowserWindow } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { app, autoUpdater } from 'electron'; import config from 'config'; import { gt } from 'semver'; import got from 'got'; +import type { UpdaterInterface } from './common'; import { checkForUpdates, deleteTempDir, @@ -19,10 +22,9 @@ import { getAutoDownloadUpdateSetting, getPrintableError, setUpdateListener, - UpdaterInterface, } from './common'; import * as durations from '../util/durations'; -import { LoggerType } from '../types/Logging'; +import type { LoggerType } from '../types/Logging'; import { hexToBinary, verifySignature } from './signature'; import { markShouldQuit } from '../../app/window_state'; import { DialogType } from '../types/Dialogs'; diff --git a/ts/updater/windows.ts b/ts/updater/windows.ts index 3a3b88059..b9f403a10 100644 --- a/ts/updater/windows.ts +++ b/ts/updater/windows.ts @@ -2,14 +2,17 @@ // SPDX-License-Identifier: AGPL-3.0-only import { dirname, join } from 'path'; -import { spawn as spawnEmitter, SpawnOptions } from 'child_process'; +import type { SpawnOptions } from 'child_process'; +import { spawn as spawnEmitter } from 'child_process'; import { readdir as readdirCallback, unlink as unlinkCallback } from 'fs'; -import { app, BrowserWindow } from 'electron'; +import type { BrowserWindow } from 'electron'; +import { app } from 'electron'; import config from 'config'; import { gt } from 'semver'; import pify from 'pify'; +import type { UpdaterInterface } from './common'; import { checkForUpdates, deleteTempDir, @@ -17,10 +20,9 @@ import { getAutoDownloadUpdateSetting, getPrintableError, setUpdateListener, - UpdaterInterface, } from './common'; import * as durations from '../util/durations'; -import { LoggerType } from '../types/Logging'; +import type { LoggerType } from '../types/Logging'; import { hexToBinary, verifySignature } from './signature'; import { markShouldQuit } from '../../app/window_state'; import { DialogType } from '../types/Dialogs'; diff --git a/ts/util/GoogleChrome.ts b/ts/util/GoogleChrome.ts index 125604e56..d098580dc 100644 --- a/ts/util/GoogleChrome.ts +++ b/ts/util/GoogleChrome.ts @@ -1,7 +1,7 @@ // Copyright 2018-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import * as MIME from '../types/MIME'; +import type * as MIME from '../types/MIME'; type MIMETypeSupportMap = Record; diff --git a/ts/util/MessageController.ts b/ts/util/MessageController.ts index b8c5a1a6e..b19ca11c1 100644 --- a/ts/util/MessageController.ts +++ b/ts/util/MessageController.ts @@ -1,7 +1,7 @@ // Copyright 2019-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { MessageModel } from '../models/messages'; +import type { MessageModel } from '../models/messages'; import * as durations from './durations'; import { map, filter } from './iterables'; import { isNotNil } from './isNotNil'; diff --git a/ts/util/arrayBufferToObjectURL.ts b/ts/util/arrayBufferToObjectURL.ts index b5d60345a..3196b0e4a 100644 --- a/ts/util/arrayBufferToObjectURL.ts +++ b/ts/util/arrayBufferToObjectURL.ts @@ -3,7 +3,7 @@ import is from '@sindresorhus/is'; -import { MIMEType } from '../types/MIME'; +import type { MIMEType } from '../types/MIME'; export const arrayBufferToObjectURL = ({ data, diff --git a/ts/util/avatarDataToBytes.ts b/ts/util/avatarDataToBytes.ts index c6a7fe809..ff121fd66 100644 --- a/ts/util/avatarDataToBytes.ts +++ b/ts/util/avatarDataToBytes.ts @@ -1,8 +1,9 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AvatarColorMap, AvatarColorType } from '../types/Colors'; -import { AvatarDataType } from '../types/Avatar'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColorMap } from '../types/Colors'; +import type { AvatarDataType } from '../types/Avatar'; import { canvasToBytes } from './canvasToBytes'; import { getFittedFontSize } from './avatarTextSizeCalculator'; diff --git a/ts/util/callingMessageToProto.ts b/ts/util/callingMessageToProto.ts index b94db068e..2735a8a0d 100644 --- a/ts/util/callingMessageToProto.ts +++ b/ts/util/callingMessageToProto.ts @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { CallingMessage, CallMessageUrgency } from 'ringrtc'; +import type { CallingMessage } from 'ringrtc'; +import { CallMessageUrgency } from 'ringrtc'; import { SignalService as Proto } from '../protobuf'; import * as log from '../logging/log'; import { missingCaseError } from './missingCaseError'; diff --git a/ts/util/callingNotification.ts b/ts/util/callingNotification.ts index 019cebf99..08ddd9bc8 100644 --- a/ts/util/callingNotification.ts +++ b/ts/util/callingNotification.ts @@ -1,7 +1,7 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { CallMode } from '../types/Calling'; import { missingCaseError } from './missingCaseError'; import * as log from '../logging/log'; diff --git a/ts/util/canvasToBytes.ts b/ts/util/canvasToBytes.ts index f970cf588..a40afc52b 100644 --- a/ts/util/canvasToBytes.ts +++ b/ts/util/canvasToBytes.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { canvasToBlob } from './canvasToBlob'; -import { MIMEType } from '../types/MIME'; +import type { MIMEType } from '../types/MIME'; export async function canvasToBytes( canvas: HTMLCanvasElement, diff --git a/ts/util/createAvatarData.ts b/ts/util/createAvatarData.ts index 073c2aa92..735cb8cda 100644 --- a/ts/util/createAvatarData.ts +++ b/ts/util/createAvatarData.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { v4 as uuid } from 'uuid'; -import { AvatarDataType } from '../types/Avatar'; +import type { AvatarDataType } from '../types/Avatar'; export function createAvatarData( partialAvatarData: Readonly> diff --git a/ts/util/createIPCEvents.ts b/ts/util/createIPCEvents.ts index 43780ef24..df143061a 100644 --- a/ts/util/createIPCEvents.ts +++ b/ts/util/createIPCEvents.ts @@ -4,20 +4,18 @@ import { webFrame } from 'electron'; import type { AudioDevice } from 'ringrtc'; -import { ZoomFactorType } from '../types/Storage.d'; -import { - DEFAULT_CONVERSATION_COLOR, +import type { ZoomFactorType } from '../types/Storage.d'; +import type { ConversationColorType, CustomColorType, DefaultConversationColorType, } from '../types/Colors'; +import { DEFAULT_CONVERSATION_COLOR } from '../types/Colors'; import * as Stickers from '../types/Stickers'; -import { - SystemTraySetting, - parseSystemTraySetting, -} from '../types/SystemTraySetting'; +import type { SystemTraySetting } from '../types/SystemTraySetting'; +import { parseSystemTraySetting } from '../types/SystemTraySetting'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { calling } from '../services/calling'; import { getConversationsWithCustomColorSelector } from '../state/selectors/conversations'; import { getCustomColors } from '../state/selectors/items'; diff --git a/ts/util/createIdenticon.tsx b/ts/util/createIdenticon.tsx index 8cdf467a3..a6d49ce41 100644 --- a/ts/util/createIdenticon.tsx +++ b/ts/util/createIdenticon.tsx @@ -4,7 +4,8 @@ import React from 'react'; import loadImage from 'blueimp-load-image'; import { renderToString } from 'react-dom/server'; -import { AvatarColorMap, AvatarColorType } from '../types/Colors'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColorMap } from '../types/Colors'; import { IdenticonSVG } from '../components/IdenticonSVG'; export function createIdenticon( diff --git a/ts/util/deleteDraftAttachment.ts b/ts/util/deleteDraftAttachment.ts index 18ec32f25..328889959 100644 --- a/ts/util/deleteDraftAttachment.ts +++ b/ts/util/deleteDraftAttachment.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; export async function deleteDraftAttachment( attachment: Pick diff --git a/ts/util/deleteForEveryone.ts b/ts/util/deleteForEveryone.ts index 89645128d..372d6d0cb 100644 --- a/ts/util/deleteForEveryone.ts +++ b/ts/util/deleteForEveryone.ts @@ -1,8 +1,8 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { DeleteModel } from '../messageModifiers/Deletes'; -import { MessageModel } from '../models/messages'; +import type { DeleteModel } from '../messageModifiers/Deletes'; +import type { MessageModel } from '../models/messages'; import * as log from '../logging/log'; const ONE_DAY = 24 * 60 * 60 * 1000; diff --git a/ts/util/downloadAttachment.ts b/ts/util/downloadAttachment.ts index 81c839a73..d02f41f68 100644 --- a/ts/util/downloadAttachment.ts +++ b/ts/util/downloadAttachment.ts @@ -1,7 +1,10 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AttachmentType, DownloadedAttachmentType } from '../types/Attachment'; +import type { + AttachmentType, + DownloadedAttachmentType, +} from '../types/Attachment'; import { downloadAttachment as doDownloadAttachment } from '../textsecure/downloadAttachment'; export async function downloadAttachment( diff --git a/ts/util/encryptProfileData.ts b/ts/util/encryptProfileData.ts index 043796aa1..da7b776af 100644 --- a/ts/util/encryptProfileData.ts +++ b/ts/util/encryptProfileData.ts @@ -1,8 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationType } from '../state/ducks/conversations'; -import { ProfileRequestDataType } from '../textsecure/WebAPI'; +import type { ConversationType } from '../state/ducks/conversations'; +import type { ProfileRequestDataType } from '../textsecure/WebAPI'; import { assert } from './assert'; import * as Bytes from '../Bytes'; import { diff --git a/ts/util/expirationTimer.ts b/ts/util/expirationTimer.ts index 5df80d6a3..c31975fc0 100644 --- a/ts/util/expirationTimer.ts +++ b/ts/util/expirationTimer.ts @@ -3,7 +3,7 @@ import * as moment from 'moment'; import humanizeDuration from 'humanize-duration'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; const SECONDS_PER_WEEK = 604800; export const DEFAULT_DURATIONS_IN_SECONDS: ReadonlyArray = [ diff --git a/ts/util/filterAndSortConversations.ts b/ts/util/filterAndSortConversations.ts index 1d6679c63..c08a5c779 100644 --- a/ts/util/filterAndSortConversations.ts +++ b/ts/util/filterAndSortConversations.ts @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import Fuse, { FuseOptions } from 'fuse.js'; +import type { FuseOptions } from 'fuse.js'; +import Fuse from 'fuse.js'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; const FUSE_OPTIONS: FuseOptions = { // A small-but-nonzero threshold lets us match parts of E164s better, and makes the diff --git a/ts/util/findAndFormatContact.ts b/ts/util/findAndFormatContact.ts index 0b20fa906..e26afd680 100644 --- a/ts/util/findAndFormatContact.ts +++ b/ts/util/findAndFormatContact.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { format, isValidNumber } from '../types/PhoneNumber'; type FormattedContact = Partial & diff --git a/ts/util/formatRelativeTime.ts b/ts/util/formatRelativeTime.ts index 95d326bc6..6c62f58c1 100644 --- a/ts/util/formatRelativeTime.ts +++ b/ts/util/formatRelativeTime.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import moment from 'moment'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; // Only applies in the english locales, but it ensures that the format // is what we want. diff --git a/ts/util/getAccessControlOptions.ts b/ts/util/getAccessControlOptions.ts index 7a41359b1..4cc545564 100644 --- a/ts/util/getAccessControlOptions.ts +++ b/ts/util/getAccessControlOptions.ts @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { SignalService as Proto } from '../protobuf'; const AccessControlEnum = Proto.AccessControl.AccessRequired; diff --git a/ts/util/getAvatarData.ts b/ts/util/getAvatarData.ts index 0aca8d276..f1e56610c 100644 --- a/ts/util/getAvatarData.ts +++ b/ts/util/getAvatarData.ts @@ -1,9 +1,10 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AvatarDataType, getDefaultAvatars } from '../types/Avatar'; +import type { AvatarDataType } from '../types/Avatar'; +import { getDefaultAvatars } from '../types/Avatar'; import { isDirectConversation } from './whatTypeOfConversation'; -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; export function getAvatarData( conversationAttrs: Pick diff --git a/ts/util/getConversationMembers.ts b/ts/util/getConversationMembers.ts index b36e796da..364702c8c 100644 --- a/ts/util/getConversationMembers.ts +++ b/ts/util/getConversationMembers.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { compact } from 'lodash'; -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; import { isDirectConversation } from './whatTypeOfConversation'; export function getConversationMembers( diff --git a/ts/util/getCustomColorStyle.ts b/ts/util/getCustomColorStyle.ts index 0ca18fe56..eeaaef7cc 100644 --- a/ts/util/getCustomColorStyle.ts +++ b/ts/util/getCustomColorStyle.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { CustomColorType } from '../types/Colors'; +import type { CustomColorType } from '../types/Colors'; import { ThemeType } from '../types/Util'; import { getHSL } from './getHSL'; import { getUserTheme } from '../shims/getUserTheme'; diff --git a/ts/util/getGroupMemberships.ts b/ts/util/getGroupMemberships.ts index d5344ffac..8cd2cd780 100644 --- a/ts/util/getGroupMemberships.ts +++ b/ts/util/getGroupMemberships.ts @@ -1,12 +1,12 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { GroupV2Membership } from '../components/conversation/conversation-details/ConversationDetailsMembershipList'; -import { +import type { GroupV2Membership } from '../components/conversation/conversation-details/ConversationDetailsMembershipList'; +import type { GroupV2PendingMembership, GroupV2RequestingMembership, } from '../components/conversation/conversation-details/PendingInvites'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { isConversationUnregistered } from './isConversationUnregistered'; export const getGroupMemberships = ( diff --git a/ts/util/getMessageTimestamp.ts b/ts/util/getMessageTimestamp.ts index ed57415fa..acd50ee84 100644 --- a/ts/util/getMessageTimestamp.ts +++ b/ts/util/getMessageTimestamp.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { Message } from '../components/conversation/media-gallery/types/Message'; +import type { Message } from '../components/conversation/media-gallery/types/Message'; export function getMessageTimestamp(message: Message): number { return message.received_at_ms || message.received_at; diff --git a/ts/util/getMuteOptions.ts b/ts/util/getMuteOptions.ts index 52019c888..5b42c4185 100644 --- a/ts/util/getMuteOptions.ts +++ b/ts/util/getMuteOptions.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as durations from './durations'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; import { getMutedUntilText } from './getMutedUntilText'; import { isMuted } from './isMuted'; diff --git a/ts/util/getMutedUntilText.ts b/ts/util/getMutedUntilText.ts index ad7002f47..858a42d99 100644 --- a/ts/util/getMutedUntilText.ts +++ b/ts/util/getMutedUntilText.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import moment from 'moment'; -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; /** * Returns something like "Muted until 6:09 PM", localized. diff --git a/ts/util/getProfile.ts b/ts/util/getProfile.ts index 626509d4c..734c53d46 100644 --- a/ts/util/getProfile.ts +++ b/ts/util/getProfile.ts @@ -1,7 +1,7 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ProfileKeyCredentialRequestContext } from 'zkgroup'; +import type { ProfileKeyCredentialRequestContext } from 'zkgroup'; import { SEALED_SENDER } from '../types/SealedSender'; import { Address } from '../types/Address'; import { QualifiedAddress } from '../types/QualifiedAddress'; diff --git a/ts/util/getSendOptions.ts b/ts/util/getSendOptions.ts index 68f688020..765413d4b 100644 --- a/ts/util/getSendOptions.ts +++ b/ts/util/getSendOptions.ts @@ -1,8 +1,11 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationAttributesType } from '../model-types.d'; -import { SendMetadataType, SendOptionsType } from '../textsecure/SendMessage'; +import type { ConversationAttributesType } from '../model-types.d'; +import type { + SendMetadataType, + SendOptionsType, +} from '../textsecure/SendMessage'; import * as Bytes from '../Bytes'; import { getRandomBytes } from '../Crypto'; import { getConversationMembers } from './getConversationMembers'; @@ -14,10 +17,8 @@ import { PhoneNumberSharingMode, parsePhoneNumberSharingMode, } from './phoneNumberSharingMode'; -import { - SenderCertificateMode, - SerializedCertificateType, -} from '../textsecure/OutgoingMessage'; +import type { SerializedCertificateType } from '../textsecure/OutgoingMessage'; +import { SenderCertificateMode } from '../textsecure/OutgoingMessage'; const SEALED_SENDER = { UNKNOWN: 0, diff --git a/ts/util/getStringForProfileChange.ts b/ts/util/getStringForProfileChange.ts index 22b5cf241..763cf152e 100644 --- a/ts/util/getStringForProfileChange.ts +++ b/ts/util/getStringForProfileChange.ts @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LocalizerType } from '../types/Util'; +import type { LocalizerType } from '../types/Util'; export type ProfileNameChangeType = { type: 'name'; diff --git a/ts/util/getTextWithMentions.ts b/ts/util/getTextWithMentions.ts index 1302f7c42..e8e23a02d 100644 --- a/ts/util/getTextWithMentions.ts +++ b/ts/util/getTextWithMentions.ts @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { BodyRangesType } from '../types/Util'; +import type { BodyRangesType } from '../types/Util'; export function getTextWithMentions( bodyRanges: BodyRangesType, diff --git a/ts/util/groupMemberNameCollisions.ts b/ts/util/groupMemberNameCollisions.ts index 35303f563..54803e0bd 100644 --- a/ts/util/groupMemberNameCollisions.ts +++ b/ts/util/groupMemberNameCollisions.ts @@ -4,7 +4,7 @@ import { mapValues, pickBy } from 'lodash'; import { groupBy, map, filter } from './iterables'; import { getOwn } from './getOwn'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { isConversationNameKnown } from './isConversationNameKnown'; import { isInSystemContacts } from './isInSystemContacts'; diff --git a/ts/util/handleAttachmentsProcessing.ts b/ts/util/handleAttachmentsProcessing.ts index 8eced891b..336e26882 100644 --- a/ts/util/handleAttachmentsProcessing.ts +++ b/ts/util/handleAttachmentsProcessing.ts @@ -6,7 +6,7 @@ import { preProcessAttachment, processAttachment, } from './processAttachment'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; import { AttachmentToastType } from '../types/AttachmentToastType'; export type AddAttachmentActionType = ( diff --git a/ts/util/handleImageAttachment.ts b/ts/util/handleImageAttachment.ts index 0b7a8508b..9809a757b 100644 --- a/ts/util/handleImageAttachment.ts +++ b/ts/util/handleImageAttachment.ts @@ -6,11 +6,10 @@ import { ipcRenderer } from 'electron'; import { v4 as genUuid } from 'uuid'; import { blobToArrayBuffer } from '../types/VisualAttachment'; -import { IMAGE_JPEG, MIMEType, isHeic, stringToMIMEType } from '../types/MIME'; -import { - InMemoryAttachmentDraftType, - canBeTranscoded, -} from '../types/Attachment'; +import type { MIMEType } from '../types/MIME'; +import { IMAGE_JPEG, isHeic, stringToMIMEType } from '../types/MIME'; +import type { InMemoryAttachmentDraftType } from '../types/Attachment'; +import { canBeTranscoded } from '../types/Attachment'; import { imageToBlurHash } from './imageToBlurHash'; import { scaleImageToLevel } from './scaleImageToLevel'; diff --git a/ts/util/handleMessageSend.ts b/ts/util/handleMessageSend.ts index 3abad8dd4..70bf4acce 100644 --- a/ts/util/handleMessageSend.ts +++ b/ts/util/handleMessageSend.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { isNumber } from 'lodash'; -import { CallbackResultType } from '../textsecure/Types.d'; +import type { CallbackResultType } from '../textsecure/Types.d'; import dataInterface from '../sql/Client'; import * as log from '../logging/log'; diff --git a/ts/util/handleRetry.ts b/ts/util/handleRetry.ts index 3ee67530c..0115b907e 100644 --- a/ts/util/handleRetry.ts +++ b/ts/util/handleRetry.ts @@ -20,8 +20,8 @@ import { QualifiedAddress } from '../types/QualifiedAddress'; import { ToastDecryptionError } from '../components/ToastDecryptionError'; import { showToast } from './showToast'; -import { ConversationModel } from '../models/conversations'; -import { +import type { ConversationModel } from '../models/conversations'; +import type { DecryptionErrorEvent, DecryptionErrorEventData, RetryRequestEvent, diff --git a/ts/util/handleVideoAttachment.ts b/ts/util/handleVideoAttachment.ts index 04589753a..b5e009f17 100644 --- a/ts/util/handleVideoAttachment.ts +++ b/ts/util/handleVideoAttachment.ts @@ -6,7 +6,7 @@ import { blobToArrayBuffer } from 'blob-util'; import * as log from '../logging/log'; import { makeVideoScreenshot } from '../types/VisualAttachment'; import { IMAGE_PNG, stringToMIMEType } from '../types/MIME'; -import { InMemoryAttachmentDraftType } from '../types/Attachment'; +import type { InMemoryAttachmentDraftType } from '../types/Attachment'; import { fileToBytes } from './fileToBytes'; export async function handleVideoAttachment( diff --git a/ts/util/isAttachmentSizeOkay.ts b/ts/util/isAttachmentSizeOkay.ts index a8bd1a1da..cc3296401 100644 --- a/ts/util/isAttachmentSizeOkay.ts +++ b/ts/util/isAttachmentSizeOkay.ts @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AttachmentType, getUploadSizeLimitKb } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; +import { getUploadSizeLimitKb } from '../types/Attachment'; import { showToast } from './showToast'; import { ToastFileSize } from '../components/ToastFileSize'; diff --git a/ts/util/isConversationAccepted.ts b/ts/util/isConversationAccepted.ts index 94dd953c5..c52c3d3a4 100644 --- a/ts/util/isConversationAccepted.ts +++ b/ts/util/isConversationAccepted.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; import { SignalService as Proto } from '../protobuf'; import { isDirectConversation, isMe } from './whatTypeOfConversation'; import { isInSystemContacts } from './isInSystemContacts'; diff --git a/ts/util/isConversationNameKnown.ts b/ts/util/isConversationNameKnown.ts index 428ae3033..d72f969a3 100644 --- a/ts/util/isConversationNameKnown.ts +++ b/ts/util/isConversationNameKnown.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { missingCaseError } from './missingCaseError'; export function isConversationNameKnown( diff --git a/ts/util/isSameAvatarData.ts b/ts/util/isSameAvatarData.ts index c1744cfcb..26ee419c6 100644 --- a/ts/util/isSameAvatarData.ts +++ b/ts/util/isSameAvatarData.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { AvatarDataType } from '../types/Avatar'; +import type { AvatarDataType } from '../types/Avatar'; export function isSameAvatarData( a?: AvatarDataType, diff --git a/ts/util/lint/analyze_exceptions.ts b/ts/util/lint/analyze_exceptions.ts index f2d6e7f2c..98734d243 100644 --- a/ts/util/lint/analyze_exceptions.ts +++ b/ts/util/lint/analyze_exceptions.ts @@ -5,7 +5,7 @@ import { join } from 'path'; import { fromPairs, groupBy, map } from 'lodash'; -import { ExceptionType } from './types'; +import type { ExceptionType } from './types'; import { loadJSON } from './util'; const exceptionsPath = join(__dirname, 'exceptions.json'); diff --git a/ts/util/lint/linter.ts b/ts/util/lint/linter.ts index 5831f64e4..0fc98dccc 100644 --- a/ts/util/lint/linter.ts +++ b/ts/util/lint/linter.ts @@ -8,7 +8,8 @@ import normalizePath from 'normalize-path'; import pMap from 'p-map'; import FastGlob from 'fast-glob'; -import { ExceptionType, REASONS, RuleType } from './types'; +import type { ExceptionType, RuleType } from './types'; +import { REASONS } from './types'; import { ENCODING, loadJSON, sortExceptions } from './util'; const ALL_REASONS = REASONS.join('|'); diff --git a/ts/util/lint/sort_exceptions.ts b/ts/util/lint/sort_exceptions.ts index 604f7623a..9c2786273 100644 --- a/ts/util/lint/sort_exceptions.ts +++ b/ts/util/lint/sort_exceptions.ts @@ -4,7 +4,7 @@ import { join } from 'path'; import { writeFileSync } from 'fs'; -import { ExceptionType } from './types'; +import type { ExceptionType } from './types'; import { loadJSON, sortExceptions } from './util'; const exceptionsPath = join(__dirname, 'exceptions.json'); diff --git a/ts/util/lint/util.ts b/ts/util/lint/util.ts index 61a7191bf..71b719e38 100644 --- a/ts/util/lint/util.ts +++ b/ts/util/lint/util.ts @@ -7,7 +7,7 @@ import { readFileSync } from 'fs'; import { omit, orderBy } from 'lodash'; -import { ExceptionType } from './types'; +import type { ExceptionType } from './types'; export const ENCODING = 'utf8'; diff --git a/ts/util/markConversationRead.ts b/ts/util/markConversationRead.ts index 60a95d4dd..7ca25b46a 100644 --- a/ts/util/markConversationRead.ts +++ b/ts/util/markConversationRead.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; import { sendReadReceiptsFor } from './sendReadReceiptsFor'; import { hasErrors } from '../state/selectors/message'; import { readSyncJobQueue } from '../jobs/readSyncJobQueue'; diff --git a/ts/util/messageBatcher.ts b/ts/util/messageBatcher.ts index 03ae54bc8..752d40d8f 100644 --- a/ts/util/messageBatcher.ts +++ b/ts/util/messageBatcher.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { MessageAttributesType } from '../model-types.d'; +import type { MessageAttributesType } from '../model-types.d'; import { createBatcher } from './batcher'; import { createWaitBatcher } from './waitBatcher'; import * as log from '../logging/log'; diff --git a/ts/util/migrateColor.ts b/ts/util/migrateColor.ts index 2385184c1..0e5abfa50 100644 --- a/ts/util/migrateColor.ts +++ b/ts/util/migrateColor.ts @@ -2,7 +2,8 @@ // SPDX-License-Identifier: AGPL-3.0-only import { sample } from 'lodash'; -import { AvatarColors, AvatarColorType } from '../types/Colors'; +import type { AvatarColorType } from '../types/Colors'; +import { AvatarColors } from '../types/Colors'; const NEW_COLOR_NAMES = new Set(AvatarColors); diff --git a/ts/util/preload.ts b/ts/util/preload.ts index d1fe16f16..f7d44ac8c 100644 --- a/ts/util/preload.ts +++ b/ts/util/preload.ts @@ -4,7 +4,7 @@ import { ipcRenderer } from 'electron'; import { strictAssert } from './assert'; -import { UnwrapPromise } from '../types/Util'; +import type { UnwrapPromise } from '../types/Util'; import type { IPCEventsValuesType, IPCEventsCallbacksType, diff --git a/ts/util/processAttachment.ts b/ts/util/processAttachment.ts index 7aa9f5bb9..01264a40a 100644 --- a/ts/util/processAttachment.ts +++ b/ts/util/processAttachment.ts @@ -4,7 +4,7 @@ import path from 'path'; import * as log from '../logging/log'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; import { AttachmentToastType } from '../types/AttachmentToastType'; import { fileToBytes } from './fileToBytes'; import { handleImageAttachment } from './handleImageAttachment'; diff --git a/ts/util/processImageFile.ts b/ts/util/processImageFile.ts index fb5528aa1..7a659d80a 100644 --- a/ts/util/processImageFile.ts +++ b/ts/util/processImageFile.ts @@ -1,7 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import loadImage, { LoadImageOptions } from 'blueimp-load-image'; +import type { LoadImageOptions } from 'blueimp-load-image'; +import loadImage from 'blueimp-load-image'; import { canvasToBytes } from './canvasToBytes'; export async function processImageFile(file: File): Promise { diff --git a/ts/util/resolveAttachmentDraftData.ts b/ts/util/resolveAttachmentDraftData.ts index e21f38d4a..543966dbb 100644 --- a/ts/util/resolveAttachmentDraftData.ts +++ b/ts/util/resolveAttachmentDraftData.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import * as log from '../logging/log'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; export async function resolveAttachmentDraftData( attachment?: AttachmentType diff --git a/ts/util/resolveAttachmentOnDisk.ts b/ts/util/resolveAttachmentOnDisk.ts index ed9ba232a..ff663a3c8 100644 --- a/ts/util/resolveAttachmentOnDisk.ts +++ b/ts/util/resolveAttachmentOnDisk.ts @@ -4,7 +4,7 @@ import { pick } from 'lodash'; import * as log from '../logging/log'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; export function resolveAttachmentOnDisk( attachment: AttachmentType diff --git a/ts/util/ringrtc/nonRenderedRemoteParticipant.ts b/ts/util/ringrtc/nonRenderedRemoteParticipant.ts index 7902cc3f7..4f2ae27a6 100644 --- a/ts/util/ringrtc/nonRenderedRemoteParticipant.ts +++ b/ts/util/ringrtc/nonRenderedRemoteParticipant.ts @@ -1,7 +1,7 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { GroupCallVideoRequest } from '../../types/Calling'; +import type { GroupCallVideoRequest } from '../../types/Calling'; export const nonRenderedRemoteParticipant = ({ demuxId, diff --git a/ts/util/safetyNumber.ts b/ts/util/safetyNumber.ts index ab0f79b80..6e4291d43 100644 --- a/ts/util/safetyNumber.ts +++ b/ts/util/safetyNumber.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { PublicKey, Fingerprint } from '@signalapp/signal-client'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; import { UUID } from '../types/UUID'; import { assert } from './assert'; diff --git a/ts/util/scaleImageToLevel.ts b/ts/util/scaleImageToLevel.ts index 262b769db..e125413d1 100644 --- a/ts/util/scaleImageToLevel.ts +++ b/ts/util/scaleImageToLevel.ts @@ -3,7 +3,8 @@ import loadImage from 'blueimp-load-image'; -import { MIMEType, IMAGE_JPEG } from '../types/MIME'; +import type { MIMEType } from '../types/MIME'; +import { IMAGE_JPEG } from '../types/MIME'; import { canvasToBlob } from './canvasToBlob'; import { getValue } from '../RemoteConfig'; diff --git a/ts/util/sendReadReceiptsFor.ts b/ts/util/sendReadReceiptsFor.ts index 267128c26..4f4973693 100644 --- a/ts/util/sendReadReceiptsFor.ts +++ b/ts/util/sendReadReceiptsFor.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { chunk, groupBy, map } from 'lodash'; -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; import { getSendOptions } from './getSendOptions'; import { handleMessageSend } from './handleMessageSend'; import { isConversationAccepted } from './isConversationAccepted'; diff --git a/ts/util/sendToGroup.ts b/ts/util/sendToGroup.ts index 156b71f23..96c325e0b 100644 --- a/ts/util/sendToGroup.ts +++ b/ts/util/sendToGroup.ts @@ -14,10 +14,10 @@ import { } from '@signalapp/signal-client'; import * as Bytes from '../Bytes'; import { senderCertificateService } from '../services/senderCertificate'; +import type { SendLogCallbackType } from '../textsecure/OutgoingMessage'; import { padMessage, SenderCertificateMode, - SendLogCallbackType, } from '../textsecure/OutgoingMessage'; import { Address } from '../types/Address'; import { QualifiedAddress } from '../types/QualifiedAddress'; @@ -25,20 +25,20 @@ import { UUID } from '../types/UUID'; import { isEnabled } from '../RemoteConfig'; import { isOlderThan } from './timestamp'; -import { +import type { GroupSendOptionsType, SendOptionsType, } from '../textsecure/SendMessage'; -import { HTTPError } from '../textsecure/Errors'; +import type { HTTPError } from '../textsecure/Errors'; import { IdentityKeys, SenderKeys, Sessions } from '../LibSignalStores'; -import { ConversationModel } from '../models/conversations'; -import { DeviceType, CallbackResultType } from '../textsecure/Types.d'; +import type { ConversationModel } from '../models/conversations'; +import type { DeviceType, CallbackResultType } from '../textsecure/Types.d'; import { getKeysForIdentifier } from '../textsecure/getKeysForIdentifier'; -import { ConversationAttributesType } from '../model-types.d'; +import type { ConversationAttributesType } from '../model-types.d'; +import type { SendTypesType } from './handleMessageSend'; import { handleMessageSend, SEALED_SENDER, - SendTypesType, shouldSaveProto, } from './handleMessageSend'; import { parseIntOrThrow } from './parseIntOrThrow'; diff --git a/ts/util/setupI18n.ts b/ts/util/setupI18n.ts index 3be612de5..e00d90530 100644 --- a/ts/util/setupI18n.ts +++ b/ts/util/setupI18n.ts @@ -1,8 +1,8 @@ // Copyright 2018-2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LocaleMessagesType } from '../types/I18N'; -import { LocalizerType } from '../types/Util'; +import type { LocaleMessagesType } from '../types/I18N'; +import type { LocalizerType } from '../types/Util'; import * as log from '../logging/log'; export function setupI18n( diff --git a/ts/util/sgnlHref.ts b/ts/util/sgnlHref.ts index 3c40a311f..043baaa13 100644 --- a/ts/util/sgnlHref.ts +++ b/ts/util/sgnlHref.ts @@ -1,7 +1,7 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { LoggerType } from '../types/Logging'; +import type { LoggerType } from '../types/Logging'; import { maybeParseUrl } from './url'; import { isValidE164 } from './isValidE164'; diff --git a/ts/util/shouldBlurAvatar.ts b/ts/util/shouldBlurAvatar.ts index 1437ad2ff..ea24a19d3 100644 --- a/ts/util/shouldBlurAvatar.ts +++ b/ts/util/shouldBlurAvatar.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationType } from '../state/ducks/conversations'; export const shouldBlurAvatar = ({ acceptedMessageRequest, diff --git a/ts/util/shouldRespondWithProfileKey.ts b/ts/util/shouldRespondWithProfileKey.ts index 7f8f0029d..6cdb74605 100644 --- a/ts/util/shouldRespondWithProfileKey.ts +++ b/ts/util/shouldRespondWithProfileKey.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationModel } from '../models/conversations'; +import type { ConversationModel } from '../models/conversations'; import { isMe } from './whatTypeOfConversation'; export async function shouldRespondWithProfileKey( diff --git a/ts/util/showToast.tsx b/ts/util/showToast.tsx index 0b9d5d35d..71aeae321 100644 --- a/ts/util/showToast.tsx +++ b/ts/util/showToast.tsx @@ -4,53 +4,53 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { ToastAlreadyGroupMember } from '../components/ToastAlreadyGroupMember'; -import { ToastAlreadyRequestedToJoin } from '../components/ToastAlreadyRequestedToJoin'; -import { ToastBlocked } from '../components/ToastBlocked'; -import { ToastBlockedGroup } from '../components/ToastBlockedGroup'; -import { ToastCannotMixImageAndNonImageAttachments } from '../components/ToastCannotMixImageAndNonImageAttachments'; -import { ToastCannotStartGroupCall } from '../components/ToastCannotStartGroupCall'; -import { ToastCaptchaFailed } from '../components/ToastCaptchaFailed'; -import { ToastCaptchaSolved } from '../components/ToastCaptchaSolved'; -import { +import type { ToastAlreadyGroupMember } from '../components/ToastAlreadyGroupMember'; +import type { ToastAlreadyRequestedToJoin } from '../components/ToastAlreadyRequestedToJoin'; +import type { ToastBlocked } from '../components/ToastBlocked'; +import type { ToastBlockedGroup } from '../components/ToastBlockedGroup'; +import type { ToastCannotMixImageAndNonImageAttachments } from '../components/ToastCannotMixImageAndNonImageAttachments'; +import type { ToastCannotStartGroupCall } from '../components/ToastCannotStartGroupCall'; +import type { ToastCaptchaFailed } from '../components/ToastCaptchaFailed'; +import type { ToastCaptchaSolved } from '../components/ToastCaptchaSolved'; +import type { ToastConversationArchived, ToastPropsType as ToastConversationArchivedPropsType, } from '../components/ToastConversationArchived'; -import { ToastConversationMarkedUnread } from '../components/ToastConversationMarkedUnread'; -import { ToastConversationUnarchived } from '../components/ToastConversationUnarchived'; -import { ToastDangerousFileType } from '../components/ToastDangerousFileType'; -import { +import type { ToastConversationMarkedUnread } from '../components/ToastConversationMarkedUnread'; +import type { ToastConversationUnarchived } from '../components/ToastConversationUnarchived'; +import type { ToastDangerousFileType } from '../components/ToastDangerousFileType'; +import type { ToastDecryptionError, ToastPropsType as ToastDecryptionErrorPropsType, } from '../components/ToastDecryptionError'; -import { ToastDeleteForEveryoneFailed } from '../components/ToastDeleteForEveryoneFailed'; -import { ToastExpired } from '../components/ToastExpired'; -import { +import type { ToastDeleteForEveryoneFailed } from '../components/ToastDeleteForEveryoneFailed'; +import type { ToastExpired } from '../components/ToastExpired'; +import type { ToastFileSaved, ToastPropsType as ToastFileSavedPropsType, } from '../components/ToastFileSaved'; -import { +import type { ToastFileSize, ToastPropsType as ToastFileSizePropsType, } from '../components/ToastFileSize'; -import { ToastGroupLinkCopied } from '../components/ToastGroupLinkCopied'; -import { ToastInvalidConversation } from '../components/ToastInvalidConversation'; -import { ToastLeftGroup } from '../components/ToastLeftGroup'; -import { ToastLinkCopied } from '../components/ToastLinkCopied'; -import { ToastLoadingFullLogs } from '../components/ToastLoadingFullLogs'; -import { ToastMaxAttachments } from '../components/ToastMaxAttachments'; -import { ToastMessageBodyTooLong } from '../components/ToastMessageBodyTooLong'; -import { ToastOneNonImageAtATime } from '../components/ToastOneNonImageAtATime'; -import { ToastOriginalMessageNotFound } from '../components/ToastOriginalMessageNotFound'; -import { ToastPinnedConversationsFull } from '../components/ToastPinnedConversationsFull'; -import { ToastReactionFailed } from '../components/ToastReactionFailed'; -import { ToastReportedSpamAndBlocked } from '../components/ToastReportedSpamAndBlocked'; -import { ToastStickerPackInstallFailed } from '../components/ToastStickerPackInstallFailed'; -import { ToastTapToViewExpiredIncoming } from '../components/ToastTapToViewExpiredIncoming'; -import { ToastTapToViewExpiredOutgoing } from '../components/ToastTapToViewExpiredOutgoing'; -import { ToastUnableToLoadAttachment } from '../components/ToastUnableToLoadAttachment'; -import { ToastVoiceNoteLimit } from '../components/ToastVoiceNoteLimit'; -import { ToastVoiceNoteMustBeOnlyAttachment } from '../components/ToastVoiceNoteMustBeOnlyAttachment'; +import type { ToastGroupLinkCopied } from '../components/ToastGroupLinkCopied'; +import type { ToastInvalidConversation } from '../components/ToastInvalidConversation'; +import type { ToastLeftGroup } from '../components/ToastLeftGroup'; +import type { ToastLinkCopied } from '../components/ToastLinkCopied'; +import type { ToastLoadingFullLogs } from '../components/ToastLoadingFullLogs'; +import type { ToastMaxAttachments } from '../components/ToastMaxAttachments'; +import type { ToastMessageBodyTooLong } from '../components/ToastMessageBodyTooLong'; +import type { ToastOneNonImageAtATime } from '../components/ToastOneNonImageAtATime'; +import type { ToastOriginalMessageNotFound } from '../components/ToastOriginalMessageNotFound'; +import type { ToastPinnedConversationsFull } from '../components/ToastPinnedConversationsFull'; +import type { ToastReactionFailed } from '../components/ToastReactionFailed'; +import type { ToastReportedSpamAndBlocked } from '../components/ToastReportedSpamAndBlocked'; +import type { ToastStickerPackInstallFailed } from '../components/ToastStickerPackInstallFailed'; +import type { ToastTapToViewExpiredIncoming } from '../components/ToastTapToViewExpiredIncoming'; +import type { ToastTapToViewExpiredOutgoing } from '../components/ToastTapToViewExpiredOutgoing'; +import type { ToastUnableToLoadAttachment } from '../components/ToastUnableToLoadAttachment'; +import type { ToastVoiceNoteLimit } from '../components/ToastVoiceNoteLimit'; +import type { ToastVoiceNoteMustBeOnlyAttachment } from '../components/ToastVoiceNoteMustBeOnlyAttachment'; export function showToast(Toast: typeof ToastAlreadyGroupMember): void; export function showToast(Toast: typeof ToastAlreadyRequestedToJoin): void; diff --git a/ts/util/sniffImageMimeType.ts b/ts/util/sniffImageMimeType.ts index 20e15c059..d52a874a7 100644 --- a/ts/util/sniffImageMimeType.ts +++ b/ts/util/sniffImageMimeType.ts @@ -1,6 +1,7 @@ // Copyright 2020-2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { MIMEType } from '../types/MIME'; import { IMAGE_BMP, IMAGE_GIF, @@ -8,7 +9,6 @@ import { IMAGE_JPEG, IMAGE_PNG, IMAGE_WEBP, - MIMEType, } from '../types/MIME'; /** diff --git a/ts/util/toggleMaximizedBrowserWindow.ts b/ts/util/toggleMaximizedBrowserWindow.ts index c0aa49fa1..4c1e3c5c8 100644 --- a/ts/util/toggleMaximizedBrowserWindow.ts +++ b/ts/util/toggleMaximizedBrowserWindow.ts @@ -1,7 +1,7 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { BrowserWindow } from 'electron'; +import type { BrowserWindow } from 'electron'; export function toggleMaximizedBrowserWindow( browserWindow: BrowserWindow diff --git a/ts/util/whatTypeOfConversation.ts b/ts/util/whatTypeOfConversation.ts index a0c9c531b..5cce2f247 100644 --- a/ts/util/whatTypeOfConversation.ts +++ b/ts/util/whatTypeOfConversation.ts @@ -1,8 +1,8 @@ // Copyright 2021 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only -import { ConversationAttributesType } from '../model-types.d'; -import { ConversationType } from '../state/ducks/conversations'; +import type { ConversationAttributesType } from '../model-types.d'; +import type { ConversationType } from '../state/ducks/conversations'; import * as Bytes from '../Bytes'; import * as log from '../logging/log'; diff --git a/ts/util/writeDraftAttachment.ts b/ts/util/writeDraftAttachment.ts index cd0c6ced8..9603df563 100644 --- a/ts/util/writeDraftAttachment.ts +++ b/ts/util/writeDraftAttachment.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import { omit } from 'lodash'; -import { AttachmentType } from '../types/Attachment'; +import type { AttachmentType } from '../types/Attachment'; export async function writeDraftAttachment( attachment: AttachmentType diff --git a/ts/util/zkgroup.ts b/ts/util/zkgroup.ts index f9349b73b..cd27dbcc8 100644 --- a/ts/util/zkgroup.ts +++ b/ts/util/zkgroup.ts @@ -1,20 +1,22 @@ // Copyright 2020 Signal Messenger, LLC // SPDX-License-Identifier: AGPL-3.0-only +import type { + FFICompatArrayType, + ProfileKeyCredentialRequestContext, +} from 'zkgroup'; import { AuthCredential, ClientZkAuthOperations, ClientZkGroupCipher, ClientZkProfileOperations, FFICompatArray, - FFICompatArrayType, GroupMasterKey, GroupSecretParams, ProfileKey, ProfileKeyCiphertext, ProfileKeyCredential, ProfileKeyCredentialPresentation, - ProfileKeyCredentialRequestContext, ProfileKeyCredentialResponse, ServerPublicParams, UuidCiphertext, diff --git a/ts/views/conversation_view.ts b/ts/views/conversation_view.ts index 45cbf1f13..3c1bdae5f 100644 --- a/ts/views/conversation_view.ts +++ b/ts/views/conversation_view.ts @@ -7,41 +7,34 @@ import { unstable_batchedUpdates as batchedUpdates } from 'react-dom'; import { debounce, flatten, omit, throttle } from 'lodash'; import { render } from 'mustache'; -import { - AttachmentDraftType, - AttachmentType, - isGIF, -} from '../types/Attachment'; +import type { AttachmentDraftType, AttachmentType } from '../types/Attachment'; +import { isGIF } from '../types/Attachment'; import * as Attachment from '../types/Attachment'; import type { StickerPackType as StickerPackDBType } from '../sql/Interface'; import * as Stickers from '../types/Stickers'; -import { BodyRangeType, BodyRangesType } from '../types/Util'; -import { - IMAGE_JPEG, - IMAGE_WEBP, - MIMEType, - stringToMIMEType, -} from '../types/MIME'; +import type { BodyRangeType, BodyRangesType } from '../types/Util'; +import type { MIMEType } from '../types/MIME'; +import { IMAGE_JPEG, IMAGE_WEBP, stringToMIMEType } from '../types/MIME'; import { sniffImageMimeType } from '../util/sniffImageMimeType'; -import { ConversationModel } from '../models/conversations'; -import { +import type { ConversationModel } from '../models/conversations'; +import type { GroupV2PendingMemberType, MessageModelCollectionType, MessageAttributesType, ConversationModelCollectionType, QuotedMessageType, } from '../model-types.d'; -import { LinkPreviewType } from '../types/message/LinkPreviews'; -import { +import type { LinkPreviewType } from '../types/message/LinkPreviews'; +import type { MediaItemType, MessageAttributesType as MediaItemMessageType, } from '../types/MediaItem'; -import { MessageModel } from '../models/messages'; +import type { MessageModel } from '../models/messages'; import { strictAssert } from '../util/assert'; import { maybeParseUrl } from '../util/url'; import { addReportSpamJob } from '../jobs/helpers/addReportSpamJob'; import { reportSpamJobQueue } from '../jobs/reportSpamJobQueue'; -import { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions'; +import type { GroupNameCollisionsWithIdsByTitle } from '../util/groupMemberNameCollisions'; import { isDirectConversation, isGroupV1, @@ -62,7 +55,7 @@ import { } from '../state/selectors/conversations'; import { ConversationDetailsMembershipList } from '../components/conversation/conversation-details/ConversationDetailsMembershipList'; import { showSafetyNumberChangeDialog } from '../shims/showSafetyNumberChangeDialog'; -import { +import type { LinkPreviewResult, LinkPreviewImage, LinkPreviewWithDomain, @@ -74,7 +67,7 @@ import type { AnyViewClass, BasicReactWrapperViewClass } from '../window.d'; import type { EmbeddedContactType } from '../types/EmbeddedContact'; import { createConversationView } from '../state/roots/createConversationView'; import { AttachmentToastType } from '../types/AttachmentToastType'; -import { CompositionAPIType } from '../components/CompositionArea'; +import type { CompositionAPIType } from '../components/CompositionArea'; import { ReadStatus } from '../messages/MessageReadStatus'; import { SignalService as Proto } from '../protobuf'; import { ToastBlocked } from '../components/ToastBlocked'; diff --git a/ts/views/inbox_view.ts b/ts/views/inbox_view.ts index a44f2d2b2..83bf5e0e0 100644 --- a/ts/views/inbox_view.ts +++ b/ts/views/inbox_view.ts @@ -3,7 +3,7 @@ import * as Backbone from 'backbone'; import * as log from '../logging/log'; -import { ConversationModel } from '../models/conversations'; +import type { ConversationModel } from '../models/conversations'; import { showToast } from '../util/showToast'; import { ToastStickerPackInstallFailed } from '../components/ToastStickerPackInstallFailed'; diff --git a/ts/workers/heicConverterWorker.ts b/ts/workers/heicConverterWorker.ts index 8eae7f5c1..caed5af0b 100644 --- a/ts/workers/heicConverterWorker.ts +++ b/ts/workers/heicConverterWorker.ts @@ -4,7 +4,7 @@ import heicConvert from 'heic-convert'; import { parentPort } from 'worker_threads'; -import { +import type { WrappedWorkerRequest, WrappedWorkerResponse, } from './heicConverterMain';