Skip to content

Commit b0470d2

Browse files
committed
More typescript fixes. typecheck passes.
1 parent 68db304 commit b0470d2

File tree

10 files changed

+39
-37
lines changed

10 files changed

+39
-37
lines changed

src/components/common/CopyFileButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const CopyFileButton = styled(
6363
<Popover content={popoverContent} trigger="hover">
6464
<Button
6565
{...props}
66-
type="ghost"
66+
ghost
6767
icon={<CopyOutlined />}
6868
onBlur={() => {
6969
setPopoverContent(popoverContentOpts.default)

src/components/common/Diff/Diff.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import DiffHeader from './DiffHeader'
1717
import { getComments } from './DiffComment'
1818
import { replaceAppDetails } from '../../../utils'
1919
import type { Theme } from '../../../theme'
20+
import type { ChangeEventArgs } from 'react-diff-view'
2021
import type { DefaultRenderToken } from 'react-diff-view/types/context'
2122

2223
const copyPathPopoverContentOpts = {
@@ -194,7 +195,7 @@ interface DiffProps {
194195
isDiffCompleted: boolean
195196
onCompleteDiff: (diffKey: string) => void
196197
selectedChanges: string[]
197-
onToggleChangeSelection: (change: string) => void
198+
onToggleChangeSelection: (args: ChangeEventArgs) => void
198199
areAllCollapsed?: boolean
199200
setAllCollapsed: (collapse: boolean | undefined) => void
200201
diffViewStyle: ViewType
@@ -291,13 +292,13 @@ const Diff = ({
291292
diffKey={diffKey}
292293
hasDiff={hunks.length > 0}
293294
isDiffCollapsed={isDiffCollapsed}
294-
setIsDiffCollapsed={(collapse, altKey) => {
295+
setIsDiffCollapsed={(collapsed: boolean, altKey?: boolean) => {
295296
if (altKey) {
296-
return setAllCollapsed(collapse)
297+
return setAllCollapsed(collapsed)
297298
}
298299

299300
setAllCollapsed(undefined)
300-
setIsDiffCollapsed(collapse)
301+
setIsDiffCollapsed(collapsed)
301302
}}
302303
isDiffCompleted={isDiffCompleted}
303304
onCopyPathToClipboard={handleCopyPathToClipboard}

src/components/common/Diff/DiffCommentReminder.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import { motion, HTMLMotionProps } from 'framer-motion'
44
import { InfoCircleOutlined } from '@ant-design/icons'
55
import { getTransitionDuration } from '../../../utils'
66
import type { Theme } from '../../../theme'
7+
import type { ReleaseCommentT } from '../../../releases/types'
78

89
interface DiffCommentReminderProps extends HTMLMotionProps<'div'> {
9-
comments: Record<string, string>
10+
comments: ReleaseCommentT[]
1011
isDiffCollapsed: boolean
1112
uncollapseDiff: () => void
1213
theme?: Theme

src/components/common/Diff/DiffHeader.tsx

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import DownloadFileButton from '../DownloadFileButton'
1717
import ViewFileButton from '../ViewFileButton'
1818
import CopyFileButton from '../CopyFileButton'
1919
import type { Theme } from '../../../theme'
20-
import type { LineChangeT } from '../../../releases/types'
20+
import type { ReleaseCommentT } from '../../../releases/types'
2121
import type { DiffType } from 'react-diff-view'
2222

2323
export const testIDs = {
@@ -56,7 +56,7 @@ const FileName = ({
5656
}: {
5757
oldPath: string
5858
newPath: string
59-
type: LineChangeT
59+
type: DiffType
6060
}) => {
6161
if (type === 'delete') {
6262
return <span>{oldPath}</span>
@@ -133,19 +133,9 @@ interface CompleteDiffButtonProps extends ButtonProps {
133133
const CompleteDiffButton = styled(
134134
({ open, onClick, ...props }: CompleteDiffButtonProps) =>
135135
open ? (
136-
<Button
137-
{...props}
138-
type="ghost"
139-
icon={<RollbackOutlined />}
140-
onClick={onClick}
141-
/>
136+
<Button {...props} ghost icon={<RollbackOutlined />} onClick={onClick} />
142137
) : (
143-
<Button
144-
{...props}
145-
type="ghost"
146-
icon={<CheckOutlined />}
147-
onClick={onClick}
148-
/>
138+
<Button {...props} ghost icon={<CheckOutlined />} onClick={onClick} />
149139
)
150140
)`
151141
${defaultIconButtonStyle}
@@ -187,7 +177,7 @@ const CopyPathToClipboardButton = styled(
187177
>
188178
<Button
189179
{...props}
190-
type="ghost"
180+
ghost
191181
icon={<CopyOutlined />}
192182
onMouseOver={resetCopyPathPopoverContent}
193183
/>
@@ -243,7 +233,7 @@ const CopyAnchorLinksToClipboardButton = styled(
243233
>
244234
<Button
245235
{...props}
246-
type="ghost"
236+
ghost
247237
icon={<LinkOutlined />}
248238
onMouseOver={resetContent}
249239
/>
@@ -295,15 +285,15 @@ interface DiffHeaderProps extends WrapperProps {
295285
diffKey: string
296286
hasDiff: boolean
297287
isDiffCollapsed: boolean
298-
setIsDiffCollapsed: (isDiffCollapsed: boolean, altKey: boolean) => void
288+
setIsDiffCollapsed: (isDiffCollapsed: boolean, altKey?: boolean) => void
299289
isDiffCompleted: boolean
300290
onCompleteDiff: (diffKey: string) => void
301291
onCopyPathToClipboard: () => void
302292
copyPathPopoverContent: string
303293
resetCopyPathPopoverContent: () => void
304294
appName: string
305295
appPackage: string
306-
diffComments: string[]
296+
diffComments: ReleaseCommentT[]
307297
packageName: string
308298
}
309299

src/components/common/Diff/DiffSection.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import styled from '@emotion/styled'
44
import semver from 'semver'
55
import Diff from './Diff'
66
import type { File } from 'gitdiff-parser'
7-
import type { ViewType } from 'react-diff-view'
7+
import type { ChangeEventArgs, ViewType } from 'react-diff-view'
88

99
export const testIDs = {
1010
diffSection: 'diffSection',
@@ -25,7 +25,7 @@ interface DiffSectionProps {
2525
toVersion: string
2626
handleCompleteDiff: (diffKey: string) => void
2727
selectedChanges: string[]
28-
onToggleChangeSelection: (diffKey: string) => void
28+
onToggleChangeSelection: (args: ChangeEventArgs) => void
2929
diffViewStyle: ViewType
3030
appName: string
3131
appPackage: string

src/components/common/DiffViewer.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import React, { useState, useEffect, useRef, useReducer } from 'react'
22
import styled from '@emotion/styled'
33
import { Alert } from 'antd'
44
import { motion, AnimatePresence, LayoutGroup } from 'framer-motion'
5-
import { type ViewType, withChangeSelect } from 'react-diff-view'
5+
import {
6+
type ViewType,
7+
withChangeSelect,
8+
ChangeEventArgs,
9+
} from 'react-diff-view'
610
import 'react-diff-view/style/index.css'
711
import { getTransitionDuration, getChangelogURL } from '../../utils'
812
import DiffSection from './Diff/DiffSection'
@@ -65,7 +69,7 @@ interface DiffViewerProps {
6569
toVersion: string
6670
shouldShowDiff: boolean
6771
selectedChanges: string[]
68-
onToggleChangeSelection: (change: string) => void
72+
onToggleChangeSelection: (args: ChangeEventArgs) => void
6973
appName: string
7074
appPackage: string
7175
}
@@ -248,6 +252,7 @@ const DiffViewer = ({
248252
packageName={packageName}
249253
isDoneSection={true}
250254
title="Done"
255+
diffViewStyle={diffViewStyle}
251256
appName={appName}
252257
appPackage={appPackage}
253258
doneTitleRef={doneTitleRef}
@@ -266,4 +271,5 @@ const DiffViewer = ({
266271
)
267272
}
268273

274+
// @ts-ignore-next-line
269275
export default withChangeSelect({ multiple: true })(DiffViewer)

src/components/common/DownloadFileButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const DownloadFileButton = ({
1919
return open ? (
2020
<Button
2121
{...props}
22-
type="ghost"
22+
ghost
2323
shape="circle"
2424
icon={<DownloadOutlined />}
2525
target="_blank"

src/components/common/TroubleshootingGuides.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const TroubleshootingGuides = ({
4646

4747
return (
4848
<Container
49+
// @ts-ignore-next-line
4950
willHaveAnimation={willHaveAnimation.current}
5051
animate={containerAnimation}
5152
>

src/components/common/VersionSelector.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,26 @@ const ToVersionSelector = styled(
5353
}
5454
`
5555

56-
const getVersionsInURL = () => {
56+
const getVersionsInURL = (): {
57+
fromVersion: string
58+
toVersion: string
59+
} => {
5760
// Parses `/?from=VERSION&to=VERSION` from URL
5861
const { from: fromVersion, to: toVersion } = queryString.parse(
5962
window.location.search
6063
)
6164

6265
return {
63-
fromVersion,
64-
toVersion,
66+
fromVersion: fromVersion as string,
67+
toVersion: toVersion as string,
6568
}
6669
}
6770

6871
// Users making changes to version should not retain anchor links
6972
// to files that may or may not change.
7073
const stripAnchorInUrl = () => {
7174
if (window.location.hash) {
72-
const url = new URL(window.location)
75+
const url = new URL(window.location.toString())
7376
url.hash = ''
7477
window.history.pushState({}, '', url)
7578
}

src/components/pages/Home.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import { DarkModeButton } from '../common/DarkModeButton'
2323
import { updateURL } from '../../utils/update-url'
2424
import { deviceSizes } from '../../utils/device-sizes'
2525
import { lightTheme, darkTheme, type Theme } from '../../theme'
26-
import { CheckboxValueType } from 'antd/es/checkbox/Group'
2726

2827
const Page = styled.div<{ theme?: Theme }>`
2928
background-color: ${({ theme }) => theme.background};
@@ -135,7 +134,7 @@ const Home = () => {
135134
const [fromVersion, setFromVersion] = useState<string>('')
136135
const [toVersion, setToVersion] = useState<string>('')
137136
const [shouldShowDiff, setShouldShowDiff] = useState<boolean>(false)
138-
const [settings, setSettings] = useState({
137+
const [settings, setSettings] = useState<Record<string, boolean>>({
139138
[`${SHOW_LATEST_RCS}`]: false,
140139
})
141140

@@ -197,7 +196,7 @@ const Home = () => {
197196
setShouldShowDiff(false)
198197
}
199198

200-
const handleSettingsChange = (settingsValues: CheckboxValueType[]) => {
199+
const handleSettingsChange = (settingsValues: string[]) => {
201200
const normalizedIncomingSettings = settingsValues.reduce((acc, val) => {
202201
acc[val] = true
203202
return acc
@@ -262,7 +261,7 @@ const Home = () => {
262261
language={language}
263262
/>
264263
<DarkModeButton
265-
isDarkMode={isDarkMode}
264+
isDarkMode={isDarkMode as boolean}
266265
onClick={toggleDarkMode}
267266
/>
268267
</SettingsContainer>
@@ -312,6 +311,7 @@ const Home = () => {
312311
rn-diff-purge output.
313312
*/}
314313
<DiffViewer
314+
//@ts-ignore-next-line
315315
shouldShowDiff={shouldShowDiff}
316316
fromVersion={fromVersion}
317317
toVersion={toVersion}

0 commit comments

Comments
 (0)