Skip to content

Commit

Permalink
Correct type imports for web-extensions package
Browse files Browse the repository at this point in the history
  • Loading branch information
Juice10 committed Jun 19, 2024
1 parent 69c2f5e commit 7d4dc21
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 28 deletions.
6 changes: 3 additions & 3 deletions packages/web-extension/src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import Browser from 'webextension-polyfill';
import type { eventWithTime } from '@rrweb/types';
import Channel from '~/utils/channel';
import {
LocalData,
type LocalData,
LocalDataKey,
RecorderStatus,
Settings,
SyncData,
type Settings,
type SyncData,
SyncDataKey,
} from '~/types';
import { pauseRecording, resumeRecording } from '~/utils/recording';
Expand Down
2 changes: 1 addition & 1 deletion packages/web-extension/src/components/CircleButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Button, ButtonProps } from '@chakra-ui/react';
import { Button, type ButtonProps } from '@chakra-ui/react';

interface CircleButtonProps extends ButtonProps {
diameter: number;
Expand Down
4 changes: 2 additions & 2 deletions packages/web-extension/src/components/SidebarWithHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
Drawer,
DrawerContent,
useDisclosure,
BoxProps,
FlexProps,
type BoxProps,
type FlexProps,
Heading,
Stack,
Text,
Expand Down
12 changes: 6 additions & 6 deletions packages/web-extension/src/content/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Browser, { Storage } from 'webextension-polyfill';
import Browser, { type Storage } from 'webextension-polyfill';
import { nanoid } from 'nanoid';
import type { eventWithTime } from '@rrweb/types';
import {
LocalData,
type LocalData,
LocalDataKey,
RecorderStatus,
ServiceName,
Session,
RecordStartedMessage,
RecordStoppedMessage,
type Session,
type RecordStartedMessage,
type RecordStoppedMessage,
MessageName,
EmitEventMessage,
type EmitEventMessage,
} from '~/types';
import Channel from '~/utils/channel';
import { isInCrossOriginIFrame } from '~/utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/web-extension/src/content/inject.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { record } from 'rrweb';
import type { recordOptions } from 'rrweb';
import type { eventWithTime } from '@rrweb/types';
import { MessageName, RecordStartedMessage } from '~/types';
import { MessageName, type RecordStartedMessage } from '~/types';
import { isInCrossOriginIFrame } from '~/utils';

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/web-extension/src/pages/SessionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import {
useReactTable,
flexRender,
getCoreRowModel,
SortingState,
type SortingState,
getSortedRowModel,
PaginationState,
type PaginationState,
} from '@tanstack/react-table';
import { VscTriangleDown, VscTriangleUp } from 'react-icons/vsc';
import { useNavigate } from 'react-router-dom';
import { Session, EventName } from '~/types';
import { type Session, EventName } from '~/types';
import Channel from '~/utils/channel';
import { deleteSessions, getAllSessions } from '~/utils/storage';
import {
Expand Down
12 changes: 4 additions & 8 deletions packages/web-extension/src/popup/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ import {
} from '@chakra-ui/react';
import { FiSettings, FiList, FiPause, FiPlay } from 'react-icons/fi';
import Channel from '~/utils/channel';
import {
import type {
LocalData,
LocalDataKey,
RecorderStatus,
ServiceName,
RecordStartedMessage,
RecordStoppedMessage,
Session,
EventName,
} from '~/types';
import { LocalDataKey, RecorderStatus, ServiceName, EventName } from '~/types';
import Browser from 'webextension-polyfill';
import { CircleButton } from '~/components/CircleButton';
import { Timer } from './Timer';
Expand All @@ -39,9 +36,8 @@ export function App() {
void Browser.storage.local.get(LocalDataKey.recorderStatus).then((data) => {
const localData = data as LocalData;
if (!localData || !localData[LocalDataKey.recorderStatus]) return;
const { status, startTimestamp, pausedTimestamp } = localData[
LocalDataKey.recorderStatus
];
const { status, startTimestamp, pausedTimestamp } =
localData[LocalDataKey.recorderStatus];
setStatus(status);
if (startTimestamp && pausedTimestamp)
setStartTime(Date.now() - pausedTimestamp + startTimestamp || 0);
Expand Down
2 changes: 1 addition & 1 deletion packages/web-extension/src/utils/channel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mitt from 'mitt';
import Browser, { Runtime } from 'webextension-polyfill';
import Browser, { type Runtime } from 'webextension-polyfill';

export type Message = EventType | ServiceType;
export type EventType = {
Expand Down
6 changes: 3 additions & 3 deletions packages/web-extension/src/utils/recording.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import Browser from 'webextension-polyfill';
import type { eventWithTime } from '@rrweb/types';

import {
LocalData,
type LocalData,
LocalDataKey,
RecorderStatus,
RecordStartedMessage,
RecordStoppedMessage,
type RecordStartedMessage,
type RecordStoppedMessage,
ServiceName,
} from '~/types';
import type Channel from './channel';
Expand Down

0 comments on commit 7d4dc21

Please sign in to comment.