Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Switch to importing @types/{event,partials} from main js-sdk export (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Aug 8, 2023
1 parent 368b6b9 commit 033c600
Show file tree
Hide file tree
Showing 125 changed files with 217 additions and 244 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ module.exports = {
name: "matrix-js-sdk/src/models/event-timeline-set",
message: "Please use matrix-js-sdk/src/matrix instead",
},
{
name: "matrix-js-sdk/src/@types/partials",
message: "Please use matrix-js-sdk/src/matrix instead",
},
{
name: "matrix-js-sdk/src/@types/event",
message: "Please use matrix-js-sdk/src/matrix instead",
},
{
name: "matrix-react-sdk",
message: "Please use matrix-react-sdk/src/index instead",
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/room/room.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.

/// <reference types="cypress" />

import { EventType } from "matrix-js-sdk/src/@types/event";
import { EventType } from "matrix-js-sdk/src/matrix";

import { HomeserverInstance } from "../../plugins/utils/homeserver";
import { MatrixClient } from "../../global";
Expand Down
10 changes: 5 additions & 5 deletions src/ContentMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ limitations under the License.
*/

import { MatrixClient } from "matrix-js-sdk/src/client";
import { MsgType } from "matrix-js-sdk/src/@types/event";
import encrypt from "matrix-encrypt-attachment";
import extractPngChunks from "png-chunks-extract";
import { IImageInfo } from "matrix-js-sdk/src/@types/partials";
import { logger } from "matrix-js-sdk/src/logger";
import {
MsgType,
IImageInfo,
HTTPError,
IEventRelation,
ISendEventResponse,
MatrixEvent,
UploadOpts,
UploadProgress,
} from "matrix-js-sdk/src/matrix";
import encrypt from "matrix-encrypt-attachment";
import extractPngChunks from "png-chunks-extract";
import { logger } from "matrix-js-sdk/src/logger";
import { THREAD_RELATION_TYPE } from "matrix-js-sdk/src/models/thread";
import { removeElement } from "matrix-js-sdk/src/utils";

Expand Down
3 changes: 1 addition & 2 deletions src/Searching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ import {
SearchOrderBy,
} from "matrix-js-sdk/src/@types/search";
import { IRoomEventFilter } from "matrix-js-sdk/src/filter";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { EventType, MatrixClient } from "matrix-js-sdk/src/matrix";
import { SearchResult } from "matrix-js-sdk/src/models/search-result";
import { MatrixClient } from "matrix-js-sdk/src/matrix";

import { ISearchArgs } from "./indexing/BaseEventIndexManager";
import EventIndexPeg from "./indexing/EventIndexPeg";
Expand Down
3 changes: 1 addition & 2 deletions src/SlidingSyncManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ limitations under the License.
* list ops)
*/

import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { MatrixClient, EventType } from "matrix-js-sdk/src/matrix";
import {
MSC3575Filter,
MSC3575List,
Expand Down
12 changes: 9 additions & 3 deletions src/TextForEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ limitations under the License.
*/

import React from "react";
import { MatrixEvent, MatrixClient } from "matrix-js-sdk/src/matrix";
import {
MatrixEvent,
MatrixClient,
GuestAccess,
HistoryVisibility,
JoinRule,
EventType,
MsgType,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { removeDirectionOverrideChars } from "matrix-js-sdk/src/utils";
import { GuestAccess, HistoryVisibility, JoinRule } from "matrix-js-sdk/src/@types/partials";
import { EventType, MsgType } from "matrix-js-sdk/src/@types/event";
import { M_POLL_START, M_POLL_END } from "matrix-js-sdk/src/@types/polls";
import { PollStartEvent } from "matrix-js-sdk/src/extensible_events_v1/PollStartEvent";

Expand Down
3 changes: 1 addition & 2 deletions src/components/structures/LegacyCallEventGrouper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { EventType } from "matrix-js-sdk/src/@types/event";
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { EventType, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { CallEvent, CallState, CallType, MatrixCall } from "matrix-js-sdk/src/webrtc/call";
import { EventEmitter } from "events";

Expand Down
3 changes: 1 addition & 2 deletions src/components/structures/LoggedInView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@ limitations under the License.

import React, { ClipboardEvent } from "react";
import { ClientEvent, MatrixClient } from "matrix-js-sdk/src/client";
import { MatrixEvent, RoomStateEvent, MatrixError } from "matrix-js-sdk/src/matrix";
import { MatrixEvent, RoomStateEvent, MatrixError, IUsageLimit } from "matrix-js-sdk/src/matrix";
import { MatrixCall } from "matrix-js-sdk/src/webrtc/call";
import classNames from "classnames";
import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync";
import { IUsageLimit } from "matrix-js-sdk/src/@types/partials";

import { isOnlyCtrlOrCmdKeyEvent, Key } from "../../Keyboard";
import PageTypes from "../../PageTypes";
Expand Down
2 changes: 1 addition & 1 deletion src/components/structures/MatrixChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import {
MatrixClient,
MatrixEventEvent,
MatrixEvent,
RoomType,
} from "matrix-js-sdk/src/matrix";
import { ISyncStateData, SyncState } from "matrix-js-sdk/src/sync";
import { InvalidStoreError } from "matrix-js-sdk/src/errors";
import { defer, IDeferred, QueryDict } from "matrix-js-sdk/src/utils";
import { logger } from "matrix-js-sdk/src/logger";
import { throttle } from "lodash";
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
import { RoomType } from "matrix-js-sdk/src/@types/event";
import { DecryptionError } from "matrix-js-sdk/src/crypto/algorithms";
import { IKeyBackupInfo } from "matrix-js-sdk/src/crypto/keybackup";

Expand Down
3 changes: 1 addition & 2 deletions src/components/structures/MessagePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ limitations under the License.
import React, { createRef, ReactNode, TransitionEvent } from "react";
import ReactDOM from "react-dom";
import classNames from "classnames";
import { Room, MatrixClient, RoomStateEvent, EventStatus, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { Room, MatrixClient, RoomStateEvent, EventStatus, MatrixEvent, EventType } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { M_BEACON_INFO } from "matrix-js-sdk/src/@types/beacon";
import { isSupportedReceiptType } from "matrix-js-sdk/src/utils";
Expand Down
5 changes: 3 additions & 2 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,17 @@ import {
MatrixEventEvent,
EventTimeline,
IRoomTimelineData,
EventType,
HistoryVisibility,
JoinRule,
} from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { CallState, MatrixCall } from "matrix-js-sdk/src/webrtc/call";
import { throttle } from "lodash";
import { MatrixError } from "matrix-js-sdk/src/http-api";
import { ClientEvent } from "matrix-js-sdk/src/client";
import { CryptoEvent } from "matrix-js-sdk/src/crypto";
import { THREAD_RELATION_TYPE } from "matrix-js-sdk/src/models/thread";
import { HistoryVisibility, JoinRule } from "matrix-js-sdk/src/@types/partials";
import { ISearchResults } from "matrix-js-sdk/src/@types/search";

import shouldHideEvent from "../../shouldHideEvent";
Expand Down
14 changes: 11 additions & 3 deletions src/components/structures/SpaceHierarchy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,21 @@ import React, {
useRef,
useState,
} from "react";
import { Room, RoomEvent, ClientEvent, MatrixClient, MatrixError } from "matrix-js-sdk/src/matrix";
import {
Room,
RoomEvent,
ClientEvent,
MatrixClient,
MatrixError,
EventType,
RoomType,
GuestAccess,
HistoryVisibility,
} from "matrix-js-sdk/src/matrix";
import { RoomHierarchy } from "matrix-js-sdk/src/room-hierarchy";
import { EventType, RoomType } from "matrix-js-sdk/src/@types/event";
import { IHierarchyRelation, IHierarchyRoom } from "matrix-js-sdk/src/@types/spaces";
import classNames from "classnames";
import { sortBy, uniqBy } from "lodash";
import { GuestAccess, HistoryVisibility } from "matrix-js-sdk/src/@types/partials";
import { logger } from "matrix-js-sdk/src/logger";

import defaultDispatcher from "../../dispatcher/dispatcher";
Expand Down
4 changes: 1 addition & 3 deletions src/components/structures/SpaceRoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import { EventType, RoomType } from "matrix-js-sdk/src/@types/event";
import { JoinRule, Preset } from "matrix-js-sdk/src/@types/partials";
import { EventType, RoomType, JoinRule, Preset, Room, RoomEvent } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";
import { Room, RoomEvent } from "matrix-js-sdk/src/matrix";
import React, { RefObject, useCallback, useContext, useRef, useState } from "react";

import MatrixClientContext from "../../contexts/MatrixClientContext";
Expand Down
3 changes: 2 additions & 1 deletion src/components/structures/TimelinePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ import {
IRoomTimelineData,
Direction,
EventTimeline,
EventType,
RelationType,
} from "matrix-js-sdk/src/matrix";
import { TimelineWindow } from "matrix-js-sdk/src/timeline-window";
import { EventType, RelationType } from "matrix-js-sdk/src/@types/event";
import { SyncState } from "matrix-js-sdk/src/sync";
import { debounce, findLastIndex, throttle } from "lodash";
import { logger } from "matrix-js-sdk/src/logger";
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/avatars/BaseAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ limitations under the License.

import React, { useCallback, useContext, useEffect, useState } from "react";
import classNames from "classnames";
import { ResizeMethod } from "matrix-js-sdk/src/@types/partials";
import { ResizeMethod } from "matrix-js-sdk/src/matrix";
import { ClientEvent } from "matrix-js-sdk/src/client";

import * as AvatarLogic from "../../../Avatar";
Expand Down
4 changes: 1 addition & 3 deletions src/components/views/avatars/DecoratedRoomAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ limitations under the License.

import React from "react";
import classNames from "classnames";
import { Room, RoomEvent, MatrixEvent, User, UserEvent } from "matrix-js-sdk/src/matrix";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { JoinRule } from "matrix-js-sdk/src/@types/partials";
import { Room, RoomEvent, MatrixEvent, User, UserEvent, EventType, JoinRule } from "matrix-js-sdk/src/matrix";
import { UnstableValue } from "matrix-js-sdk/src/NamespacedValue";

import RoomAvatar from "./RoomAvatar";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/avatars/MemberAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ limitations under the License.
*/

import React, { ReactNode, useContext } from "react";
import { RoomMember } from "matrix-js-sdk/src/matrix";
import { ResizeMethod } from "matrix-js-sdk/src/@types/partials";
import { RoomMember, ResizeMethod } from "matrix-js-sdk/src/matrix";

import dis from "../../../dispatcher/dispatcher";
import { Action } from "../../../dispatcher/actions";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/avatars/RoomAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ limitations under the License.
*/

import React, { ComponentProps } from "react";
import { Room, RoomStateEvent, MatrixEvent } from "matrix-js-sdk/src/matrix";
import { Room, RoomStateEvent, MatrixEvent, EventType, RoomType } from "matrix-js-sdk/src/matrix";
import classNames from "classnames";
import { EventType, RoomType } from "matrix-js-sdk/src/@types/event";

import BaseAvatar from "./BaseAvatar";
import ImageView from "../elements/ImageView";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/beacon/RoomCallBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import React, { useCallback } from "react";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { Room } from "matrix-js-sdk/src/matrix";
import { EventType, Room } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";

import { _t } from "../../../languageHandler";
Expand Down
10 changes: 8 additions & 2 deletions src/components/views/context_menus/MessageContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ limitations under the License.
*/

import React, { createRef, useContext } from "react";
import { EventStatus, MatrixEvent, MatrixEventEvent, RoomMemberEvent } from "matrix-js-sdk/src/matrix";
import { EventType, RelationType } from "matrix-js-sdk/src/@types/event";
import {
EventStatus,
MatrixEvent,
MatrixEventEvent,
RoomMemberEvent,
EventType,
RelationType,
} from "matrix-js-sdk/src/matrix";
import { Relations } from "matrix-js-sdk/src/models/relations";
import { M_POLL_START } from "matrix-js-sdk/src/@types/polls";
import { Thread } from "matrix-js-sdk/src/models/thread";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/context_menus/SpaceContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import React, { useContext } from "react";
import { Room } from "matrix-js-sdk/src/matrix";
import { EventType, RoomType } from "matrix-js-sdk/src/@types/event";
import { Room, EventType, RoomType } from "matrix-js-sdk/src/matrix";

import { IProps as IContextMenuProps } from "../../structures/ContextMenu";
import IconizedContextMenu, { IconizedContextMenuOption, IconizedContextMenuOptionList } from "./IconizedContextMenu";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/dialogs/AddExistingToSpaceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ limitations under the License.

import React, { ReactElement, ReactNode, RefObject, useContext, useMemo, useRef, useState } from "react";
import classNames from "classnames";
import { Room } from "matrix-js-sdk/src/matrix";
import { Room, EventType } from "matrix-js-sdk/src/matrix";
import { sleep } from "matrix-js-sdk/src/utils";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { logger } from "matrix-js-sdk/src/logger";

import { _t, _td } from "../../../languageHandler";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/dialogs/BulkRedactDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ limitations under the License.
import React, { useState } from "react";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { RoomMember, Room, MatrixEvent, EventTimeline } from "matrix-js-sdk/src/matrix";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { RoomMember, Room, MatrixEvent, EventTimeline, EventType } from "matrix-js-sdk/src/matrix";

import { _t } from "../../../languageHandler";
import dis from "../../../dispatcher/dispatcher";
Expand Down
4 changes: 1 addition & 3 deletions src/components/views/dialogs/CreateRoomDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ limitations under the License.
*/

import React, { ChangeEvent, createRef, KeyboardEvent, SyntheticEvent } from "react";
import { Room } from "matrix-js-sdk/src/matrix";
import { RoomType } from "matrix-js-sdk/src/@types/event";
import { JoinRule, Preset, Visibility } from "matrix-js-sdk/src/@types/partials";
import { Room, RoomType, JoinRule, Preset, Visibility } from "matrix-js-sdk/src/matrix";

import SdkConfig from "../../../SdkConfig";
import withValidation, { IFieldState, IValidationResult } from "../elements/Validation";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/dialogs/CreateSubspaceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import React, { useRef, useState } from "react";
import { Room } from "matrix-js-sdk/src/matrix";
import { JoinRule } from "matrix-js-sdk/src/@types/partials";
import { Room, JoinRule } from "matrix-js-sdk/src/matrix";
import { logger } from "matrix-js-sdk/src/logger";

import { _t } from "../../../languageHandler";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/dialogs/ForwardDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ limitations under the License.

import React, { useEffect, useMemo, useState } from "react";
import classnames from "classnames";
import { IContent, MatrixEvent, Room, RoomMember } from "matrix-js-sdk/src/matrix";
import { IContent, MatrixEvent, Room, RoomMember, EventType } from "matrix-js-sdk/src/matrix";
import { MatrixClient } from "matrix-js-sdk/src/client";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { ILocationContent, LocationAssetType, M_TIMESTAMP } from "matrix-js-sdk/src/@types/location";
import { makeLocationContent } from "matrix-js-sdk/src/content-helpers";
import { M_BEACON } from "matrix-js-sdk/src/@types/beacon";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/dialogs/LeaveSpaceDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import React, { useMemo, useState } from "react";
import { Room } from "matrix-js-sdk/src/matrix";
import { JoinRule } from "matrix-js-sdk/src/@types/partials";
import { Room, JoinRule } from "matrix-js-sdk/src/matrix";

import { _t } from "../../../languageHandler";
import DialogButtons from "../elements/DialogButtons";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/dialogs/MessageEditHistoryDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import React from "react";
import { MatrixEvent } from "matrix-js-sdk/src/matrix";
import { EventType, RelationType } from "matrix-js-sdk/src/@types/event";
import { MatrixEvent, EventType, RelationType } from "matrix-js-sdk/src/matrix";
import { defer } from "matrix-js-sdk/src/utils";
import { logger } from "matrix-js-sdk/src/logger";
import { MatrixClient } from "matrix-js-sdk/src/client";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/dialogs/RoomUpgradeWarningDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ limitations under the License.
*/

import React, { ReactNode, SyntheticEvent } from "react";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { JoinRule } from "matrix-js-sdk/src/@types/partials";
import { EventType, JoinRule } from "matrix-js-sdk/src/matrix";

import { _t } from "../../../languageHandler";
import SdkConfig from "../../../SdkConfig";
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/dialogs/devtools/ServersInRoom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ limitations under the License.
*/

import React, { useContext, useMemo } from "react";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { EventType } from "matrix-js-sdk/src/matrix";

import BaseTool, { DevtoolsContext, IDevtoolsProps } from "./BaseTool";
import { _t } from "../../../../languageHandler";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/elements/EventListSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ limitations under the License.
*/

import React, { ComponentProps, ReactNode } from "react";
import { MatrixEvent, RoomMember } from "matrix-js-sdk/src/matrix";
import { EventType } from "matrix-js-sdk/src/@types/event";
import { MatrixEvent, RoomMember, EventType } from "matrix-js-sdk/src/matrix";

import { _t } from "../../../languageHandler";
import { formatCommaSeparatedList } from "../../../utils/FormattingUtils";
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/elements/EventTilePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ limitations under the License.

import React from "react";
import classnames from "classnames";
import { MatrixEvent, RoomMember } from "matrix-js-sdk/src/matrix";
import { MsgType } from "matrix-js-sdk/src/@types/event";
import { MatrixEvent, RoomMember, MsgType } from "matrix-js-sdk/src/matrix";

import * as Avatar from "../../../Avatar";
import EventTile from "../rooms/EventTile";
Expand Down
Loading

0 comments on commit 033c600

Please sign in to comment.