Skip to content

Commit

Permalink
Fix some weird broken mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Jan 18, 2025
1 parent b808105 commit 975eef9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonlight-mod/mappings",
"version": "1.1.0",
"version": "1.1.1",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
28 changes: 2 additions & 26 deletions src/mappings/discord/Dispatcher.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,8 @@
import register from "../../registry";
import { Dispatcher as OrigDispatcher } from "flux";

type Dispatcher = OrigDispatcher<any> & {
dispatch: (payload: any) => void;
isDispatching: () => boolean;

addInterceptor: (interceptor: (event: any) => boolean | void) => void;

flushWaitQueue: () => void;
wait: (callback: () => void) => void;

subscribe: (eventType: string, callback: (event: any) => void) => void;
unsubscribe: (eventType: string, callback: (event: any) => void) => void;

register: (
name: string,
actionHandlers: Record<string, (event: any) => void>,
storeDidChange: (event: any) => void,
band: number,
token: string
) => number;

createToken: () => string;
addDependencies: (id: string, deps: string[]) => void;
};
import type { Dispatcher } from "./packages/flux/Dispatcher";

type Exports = {
default: Dispatcher;
default: Dispatcher<any>;
};
export default Exports;

Expand Down
4 changes: 2 additions & 2 deletions src/mappings/discord/components/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export type IconSize = "xxs" | "xs" | "sm" | "md" | "lg" | "custom" | "refresh_s

export type IconProps = {
size?: IconSize;
width: number;
height: number;
width?: number;
height?: number;
color?: CSS.DataType.Color;
colorClass?: string;
[index: string]: any;
Expand Down
4 changes: 2 additions & 2 deletions src/mappings/discord/packages/flux/PersistedStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export declare abstract class PersistedStore<T extends BasePayload> extends Stor
/**
* Returns `this.constructor`
*/
getClass(): (dispatcher: typeof Dispatcher, actionHandlers?: Record<T["type"], ActionHandler<T>>) => this;
getClass(): (dispatcher: Dispatcher<any>, actionHandlers?: Record<T["type"], ActionHandler<T>>) => this;
static clearAll(toClear: ClearAll): Promise<void> | null | undefined;
static shouldClear(toClear: ClearAll, store: string): boolean;
static clearPersistQueue(store: string): void;
Expand All @@ -49,7 +49,7 @@ export declare abstract class PersistedStore<T extends BasePayload> extends Stor
initialize(state?: T): void;
getState(): T;

constructor(dispatcher: typeof Dispatcher, actionHandlers?: Record<T["type"], ActionHandler<T>>);
constructor(dispatcher: Dispatcher<any>, actionHandlers?: Record<T["type"], ActionHandler<T>>);
}

declare abstract class UserAgnosticStore<T extends BasePayload> extends PersistedStore<T> {
Expand Down
4 changes: 2 additions & 2 deletions src/mappings/discord/packages/flux/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export declare abstract class Store<T extends BasePayload> {
_reactChangeCallbacks: ChangeListeners;
_syncsWith: SyncsWith[];
_dispatchToken: string;
_dispatcher: typeof Dispatcher;
_dispatcher: Dispatcher<any>;
_mustEmitChanges: () => boolean;
_isInitialized: boolean;
__getLocalVars(): any; // most discord stores dont add it anymore o7
Expand All @@ -41,7 +41,7 @@ export declare abstract class Store<T extends BasePayload> {
getDispatchToken(): string;
mustEmitChanges(should?: () => boolean): void;

constructor(dispatcher: typeof Dispatcher, actionHandlers?: Record<T["type"], ActionHandler<T>>, band?: number);
constructor(dispatcher: Dispatcher<any>, actionHandlers?: Record<T["type"], ActionHandler<T>>, band?: number);
}

export type Exports = {
Expand Down
10 changes: 4 additions & 6 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,11 @@ export type MappedModules = {
"discord/utils/NativeUtils": NativeUtils;
"highlight.js": HighlightJS;
"highlight.js/lib/core": HighlightJSCore;
"lodash": lodash;
"murmurhash": murmurhash;
lodash: lodash;
murmurhash: murmurhash;
"platform.js": PlatformJS;
"react": React;
react: React;
"uuid/v4": UUID;
};

export declare function WebpackRequire<T extends keyof MappedModules>(
module: T
): MappedModules[T];
export declare function WebpackRequire<T extends keyof MappedModules>(module: T): MappedModules[T];

0 comments on commit 975eef9

Please sign in to comment.