Skip to content

Commit d753f0e

Browse files
committed
Fix redudant types
1 parent 0c1f210 commit d753f0e

35 files changed

+58
-68
lines changed

site/.eslintrc.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ rules:
7575
"@typescript-eslint/restrict-template-expressions": "off"
7676
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
7777
"@typescript-eslint/unbound-method": "off"
78-
# TODO: Investigate whether to enable this rule & fix and/or disable all its complaints
79-
"@typescript-eslint/no-redundant-type-constituents": "off"
8078
# We're disabling the `no-namespace` rule to use a pattern of defining an interface,
8179
# and then defining functions that operate on that data via namespace. This is helpful for
8280
# dealing with immutable objects. This is a common pattern that shows up in some other

site/src/api/errors.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const mapApiErrorToFieldErrors = (
5959
* @returns error's message if ApiError or Error, else defaultMessage
6060
*/
6161
export const getErrorMessage = (
62-
error: Error | ApiError | unknown,
62+
error: unknown,
6363
defaultMessage: string,
6464
): string =>
6565
isApiError(error)
@@ -74,19 +74,15 @@ export const getErrorMessage = (
7474
* @returns a combined validation error message if the error is an ApiError
7575
* and contains validation messages for different form fields.
7676
*/
77-
export const getValidationErrorMessage = (
78-
error: Error | ApiError | unknown,
79-
): string => {
77+
export const getValidationErrorMessage = (error: unknown): string => {
8078
const validationErrors =
8179
isApiError(error) && error.response.data.validations
8280
? error.response.data.validations
8381
: []
8482
return validationErrors.map((error) => error.detail).join("\n")
8583
}
8684

87-
export const getErrorDetail = (
88-
error: Error | ApiError | unknown,
89-
): string | undefined | null =>
85+
export const getErrorDetail = (error: unknown): string | undefined | null =>
9086
isApiError(error)
9187
? error.response.data.detail
9288
: error instanceof Error

site/src/components/DeploySettingsLayout/Option.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { makeStyles } from "@mui/styles"
2-
import { PropsWithChildren, FC, ReactNode } from "react"
2+
import { PropsWithChildren, FC } from "react"
33
import { MONOSPACE_FONT_FAMILY } from "theme/constants"
44
import { DisabledBadge, EnabledBadge } from "./Badges"
55

@@ -19,9 +19,7 @@ const NotSet: FC = () => {
1919
return <span className={styles.optionValue}>Not set</span>
2020
}
2121

22-
export const OptionValue: FC<{ children?: ReactNode | unknown }> = ({
23-
children,
24-
}) => {
22+
export const OptionValue: FC<{ children?: unknown }> = ({ children }) => {
2523
const styles = useStyles()
2624

2725
if (typeof children === "boolean") {

site/src/components/DeploySettingsLayout/Options.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const defaultOption: DeploymentOption = {
1313
describe("optionValue", () => {
1414
it.each<{
1515
option: DeploymentOption
16-
expected: string | string[] | unknown
16+
expected: unknown
1717
}>([
1818
{
1919
option: {

site/src/components/DeploySettingsLayout/OptionsTable.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ const OptionsTable: FC<{
6262
}
6363

6464
// optionValue is a helper function to format the value of a specific deployment options
65-
export function optionValue(
66-
option: DeploymentOption,
67-
): string[] | string | unknown {
65+
export function optionValue(option: DeploymentOption) {
6866
switch (option.name) {
6967
case "Max Token Lifetime":
7068
case "Session Duration":

site/src/components/SettingsAccountForm/SettingsAccountForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface AccountFormProps {
3131
isLoading: boolean
3232
initialValues: AccountFormValues
3333
onSubmit: (values: AccountFormValues) => void
34-
updateProfileError?: Error | unknown
34+
updateProfileError?: unknown
3535
// initialTouched is only used for testing the error state of the form.
3636
initialTouched?: FormikTouched<AccountFormValues>
3737
}

site/src/components/Workspace/Workspace.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export interface WorkspaceProps {
6464
canChangeVersions: boolean
6565
hideSSHButton?: boolean
6666
hideVSCodeDesktopButton?: boolean
67-
workspaceErrors: Partial<Record<WorkspaceErrors, Error | unknown>>
67+
workspaceErrors: Partial<Record<WorkspaceErrors, unknown>>
6868
buildInfo?: TypesGen.BuildInfoResponse
6969
sshPrefix?: string
7070
template?: TypesGen.Template

site/src/components/WorkspacesTable/WorkspacesTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface WorkspacesTableProps {
1919
workspaces?: Workspace[]
2020
isUsingFilter: boolean
2121
onUpdateWorkspace: (workspace: Workspace) => void
22-
error?: Error | unknown
22+
error?: unknown
2323
}
2424

2525
export const WorkspacesTable: FC<WorkspacesTableProps> = ({

site/src/components/WorkspacesTable/WorkspacesTableBody.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface TableBodyProps {
1414
workspaces?: Workspace[]
1515
isUsingFilter: boolean
1616
onUpdateWorkspace: (workspace: Workspace) => void
17-
error?: Error | unknown
17+
error?: unknown
1818
}
1919

2020
export const WorkspacesTableBody: FC<

site/src/contexts/ProxyContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export interface ProxyContextValue {
4646
// isFetched is true when the 'proxies' api call is complete.
4747
isFetched: boolean
4848
isLoading: boolean
49-
error?: Error | unknown
49+
error?: unknown
5050
// proxyLatencies is a map of proxy id to latency report. If the proxyLatencies[proxy.id] is undefined
5151
// then the latency has not been fetched yet. Calculations happen async for each proxy in the list.
5252
// Refer to the returned report for a given proxy for more information.

0 commit comments

Comments
 (0)