Skip to content

Commit

Permalink
replace unused to _
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaJ2305 committed Jan 20, 2025
1 parent a53aa91 commit 56bafb2
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
5 changes: 2 additions & 3 deletions src/Routers/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import careConfig from "@careConfig";
import { Redirect, useRedirect, useRoutes } from "raviger";

Expand Down Expand Up @@ -33,9 +32,9 @@ const PATHS_WITHOUT_SIDEBAR = ["/", "/session-expired"];

export type RouteParams<T extends string> =
T extends `${string}:${infer Param}/${infer Rest}`
? { [K in Param | keyof RouteParams<Rest>]: string }
? { [_ in Param | keyof RouteParams<Rest>]: string }
: T extends `${string}:${infer Param}`
? { [K in Param]: string }
? { [_ in Param]: string }
: Record<string, never>;

export type RouteFunction<T extends string> = (
Expand Down
3 changes: 1 addition & 2 deletions src/Utils/request/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ type ExtractRouteParams<T extends string> =
: never;

type PathParams<T extends string> = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
[K in ExtractRouteParams<T>]: string;
[_ in ExtractRouteParams<T>]: string;
};

export interface ApiCallOptions<Route extends ApiRoute<unknown, unknown>> {
Expand Down
16 changes: 6 additions & 10 deletions src/Utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,37 @@ export interface BaseModel {
* If a property was originally `readonly`, it becomes optional.
* Otherwise, it remains required.
*/
/* eslint-disable @typescript-eslint/no-unused-vars */
export type Writable<T> = T extends object
? {
[P in keyof T as IfEquals<
{ [Q in P]: T[P] },
{ -readonly [Q in P]: T[P] },
{ [_ in P]: T[P] },
{ -readonly [_ in P]: T[P] },
never,
P
>]?: undefined;
} & {
[P in keyof T as IfEquals<
{ [Q in P]: T[P] },
{ -readonly [Q in P]: T[P] },
{ [_ in P]: T[P] },
{ -readonly [_ in P]: T[P] },
P,
never
>]: T[P] extends object ? Writable<T[P]> : T[P];
}
: T;
/* eslint-enable @typescript-eslint/no-unused-vars */

/**
* A utility type that includes only the non-readonly properties of `T` recursively.
* Or in other words, excludes all `readonly` properties.
*/
/* eslint-disable @typescript-eslint/no-unused-vars */
export type WritableOnly<T> = T extends object
? {
[P in keyof T as IfEquals<
{ [Q in P]: T[P] },
{ -readonly [Q in P]: T[P] },
{ [_ in P]: T[P] },
{ -readonly [_ in P]: T[P] },
P
>]: T[P] extends object ? WritableOnly<T[P]> : T[P];
}
: T;
/* eslint-enable @typescript-eslint/no-unused-vars */

type IfEquals<X, Y, A = X, B = never> =
(<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? A : B;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { cn } from "@/lib/utils";
const THEMES = { light: "", dark: ".dark" } as const;

export type ChartConfig = {
[key: string]: {
[_ in string]: {
label?: React.ReactNode;
icon?: React.ComponentType;
} & (
Expand Down
1 change: 0 additions & 1 deletion vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { VitePWA } from "vite-plugin-pwa";
import { viteStaticCopy } from "vite-plugin-static-copy";
import { z } from "zod";

// eslint-disable-next-line no-relative-import-paths/no-relative-import-paths
import { treeShakeCareIcons } from "./plugins/treeShakeCareIcons";

const pdfWorkerPath = path.join(
Expand Down

0 comments on commit 56bafb2

Please sign in to comment.