Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
yofukashino committed Oct 21, 2024
1 parent 7b8893c commit 17e0fe7
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/renderer/apis/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ export class SettingsManager<T extends Record<string, Jsonifiable>, D extends ke
): K extends D
? NonNullable<T[K]>
: F extends null | undefined
? T[K] | undefined
: NonNullable<T[K]> | F {
? T[K] | undefined
: NonNullable<T[K]> | F {
if (typeof this.#settings === "undefined") {
throw new Error(`Settings not loaded for namespace ${this.namespace}`);
}
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/coremods/commands/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ export function loadCommands(): void {
listType === "enabled"
? enabledString
: listType === "disabled"
? disabledString
: `${enabledString}\n\n${disabledString}`;
? disabledString
: `${enabledString}\n\n${disabledString}`;

return {
send,
Expand Down Expand Up @@ -383,8 +383,8 @@ export function loadCommands(): void {
listType === "enabled"
? enabledString
: listType === "disabled"
? disabledString
: `${enabledString}\n\n${disabledString}`;
? disabledString
: `${enabledString}\n\n${disabledString}`;

return {
send,
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/coremods/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ async function injectApplicationCommandSearchStore(): Promise<void> {
);
if (!commandAndSectionsArray.length) return;
if (
!commandAndSectionsArray.every(
(commandAndSection) => res?.some((section) => section.id === commandAndSection.section.id),
!commandAndSectionsArray.every((commandAndSection) =>
res.some((section) => section.id === commandAndSection.section.id),
)
) {
const sectionsToAdd = commandAndSectionsArray
.map((commandAndSection) => commandAndSection.section)
.filter((section) => res?.some((existingSections) => section.id === existingSections.id));
.filter((section) => res.some((existingSections) => section.id === existingSections.id));
res.push(...sectionsToAdd);
}
return res;
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/coremods/settings/pages/Updater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ const logger = Logger.coremod("Settings:Updater");

export const Updater = (): React.ReactElement => {
const [checking, setChecking] = React.useState(false);
const [updatesAvailable, setUpdatesAvailable] = React.useState<
Array<UpdateSettings & { id: string }>
>(getAvailableUpdates());
const [updatesAvailable, setUpdatesAvailable] =
React.useState<Array<UpdateSettings & { id: string }>>(getAvailableUpdates());
const [updatePromises, setUpdatePromises] = React.useState<Record<string, Promise<boolean>>>({});
const [didInstallAll, setDidInstallAll] = React.useState(false);
const [lastChecked, setLastChecked] = useSettingArray(updaterSettings, "lastChecked");
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/modules/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export function load(): void {

i18n.on("locale", (newLocale: string) => {
locale = newLocale;
i18n.loadPromise.then(addRepluggedStrings)!;
i18n.loadPromise.then(addRepluggedStrings);
});

i18n.loadPromise.then(addRepluggedStrings)!;
i18n.loadPromise.then(addRepluggedStrings);

addRepluggedStrings();
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/modules/webpack/get-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function getExportsForProps<T, P extends PropertyKey = keyof T>(
if (
props.every((p) =>
options?.byPrototype
? (exported?.prototype as Record<P, unknown>)?.[p]
? (exported.prototype as Record<P, unknown>)[p]
: p in (exported as Record<P, unknown>),
)
) {
Expand Down
10 changes: 5 additions & 5 deletions src/renderer/modules/webpack/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ export function getByProps<T, P extends PropertyKey = keyof T>(
const raw = typeof args[0] === "string" ? false : (args[1] as GetModuleOptions | undefined)?.raw;

const byPrototype =
typeof args[0] === "string" ? false : (args[1] as ByPropsOptions)?.byPrototype;
typeof args[0] === "string" ? false : (args[1] as ByPropsOptions).byPrototype;

const result =
typeof args.at(-1) === "object"
? getModule<T>(filters.byProps(...props, { byPrototype }), args.at(-1) as GetModuleOptions)
Expand Down Expand Up @@ -156,9 +156,9 @@ export async function waitForProps<T, P extends PropertyKey = keyof T>(
): Promise<T | RawModule<T>> {
const props = (typeof args[0] === "string" ? args : args[0]) as P[];
const raw = typeof args[0] === "string" ? false : (args[1] as WaitForOptions | undefined)?.raw;
const byPrototype =
typeof args[0] === "string" ? false : (args[1] as ByPropsOptions)?.byPrototype;
const byPrototype =
typeof args[0] === "string" ? false : (args[1] as ByPropsOptions).byPrototype;

const result = await (typeof args.at(-1) === "object"
? waitForModule<T>(filters.byProps(...props, { byPrototype }), args.at(-1) as WaitForOptions)
: waitForModule<T>(filters.byProps(...props, { byPrototype })));
Expand Down
13 changes: 6 additions & 7 deletions src/renderer/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ export function useSetting<
value: K extends D
? NonNullable<T[K]>
: F extends null | undefined
? T[K] | undefined
: NonNullable<T[K]> | F;
? T[K] | undefined
: NonNullable<T[K]> | F;
onChange: (newValue: ValType<T[K]>) => void;
} {
const initial = settings.get(key, fallback);
Expand Down Expand Up @@ -237,8 +237,8 @@ export function useSettingArray<
K extends D
? NonNullable<T[K]>
: F extends null | undefined
? T[K] | undefined
: NonNullable<T[K]> | F,
? T[K] | undefined
: NonNullable<T[K]> | F,
(newValue: ValType<T[K]>) => void,
] {
const { value, onChange } = useSetting(settings, key, fallback);
Expand All @@ -256,9 +256,8 @@ type UnionToIntersection<U> = (U extends never ? never : (k: U) => void) extends

type ObjectType = Record<never, never>;

type ExtractObjectType<O extends ObjectType[]> = O extends Array<infer T>
? UnionToIntersection<T>
: never;
type ExtractObjectType<O extends ObjectType[]> =
O extends Array<infer T> ? UnionToIntersection<T> : never;

export function virtualMerge<O extends ObjectType[]>(...objects: O): ExtractObjectType<O> {
const fallback = {};
Expand Down

0 comments on commit 17e0fe7

Please sign in to comment.