diff --git a/src/webpack/common/stores.ts b/src/webpack/common/stores.ts index ff668425f..518f13e22 100644 --- a/src/webpack/common/stores.ts +++ b/src/webpack/common/stores.ts @@ -29,7 +29,7 @@ export type GenericStore = t.FluxStore & Record; export const DraftType = findByPropsLazy("ChannelMessage", "SlashCommand"); -export let MessageStore: Omit & { +export let MessageStore: Omit & GenericStore & { getMessages(chanId: string): any; }; diff --git a/src/webpack/common/types/components.d.ts b/src/webpack/common/types/components.d.ts index 8113e826a..469cd4289 100644 --- a/src/webpack/common/types/components.d.ts +++ b/src/webpack/common/types/components.d.ts @@ -496,7 +496,7 @@ export type Avatar = ComponentType>; type FocusLock = ComponentType; + containerRef: Ref; }>>; export type Icon = ComponentType. */ -import { DraftType } from "@webpack/common"; import { Channel, Guild, Role } from "discord-types/general"; import { FluxDispatcher, FluxEvents } from "./utils"; @@ -229,7 +228,7 @@ export class ThemeStore extends FluxStore { } export type useStateFromStores = ( - stores: t.FluxStore[], + stores: any[], mapper: () => T, dependencies?: any, isEqual?: (old: T, newer: T) => boolean diff --git a/src/webpack/patchWebpack.ts b/src/webpack/patchWebpack.ts index 408d3b708..a185f1428 100644 --- a/src/webpack/patchWebpack.ts +++ b/src/webpack/patchWebpack.ts @@ -193,13 +193,13 @@ define(Function.prototype, "m", { // Overwrite Webpack's defineExports function to define the export descriptors configurable. // This is needed so we can later blacklist specific exports from Webpack search by making them non-enumerable - this.d = function (exports: object, getters: object) { - for (const key in getters) { - if (Object.hasOwn(getters, key) && !Object.hasOwn(exports, key)) { + this.d = function (exports, definition) { + for (const key in definition) { + if (Object.hasOwn(definition, key) && !Object.hasOwn(exports, key)) { Object.defineProperty(exports, key, { enumerable: true, configurable: true, - get: getters[key], + get: definition[key], }); } } diff --git a/src/webpack/webpack.ts b/src/webpack/webpack.ts index 30180a7e9..6b17bd1d6 100644 --- a/src/webpack/webpack.ts +++ b/src/webpack/webpack.ts @@ -131,7 +131,7 @@ function shouldIgnoreValue(value: any) { return false; } -function makePropertyNonEnumerable(target: Object, key: PropertyKey) { +function makePropertyNonEnumerable(target: Record, key: PropertyKey) { const descriptor = Object.getOwnPropertyDescriptor(target, key); if (descriptor == null) return; @@ -499,7 +499,7 @@ export function findExportedComponentLazy(...props: Prop }); } -function getAllPropertyNames(object: Object, includeNonEnumerable: boolean) { +function getAllPropertyNames(object: Record, includeNonEnumerable: boolean) { const names = new Set(); const getKeys = includeNonEnumerable ? Object.getOwnPropertyNames : Object.keys; diff --git a/src/webpack/wreq.d.ts b/src/webpack/wreq.d.ts index ff28732c6..2b356f9d1 100644 --- a/src/webpack/wreq.d.ts +++ b/src/webpack/wreq.d.ts @@ -17,14 +17,11 @@ export type Module = { /** exports can be anything, however initially it is always an empty object */ export type ModuleFactory = (this: ModuleExports, module: Module, exports: ModuleExports, require: WebpackRequire) => void; -export type WebpackQueues = unique symbol | "__webpack_queues__"; -export type WebpackExports = unique symbol | "__webpack_exports__"; -export type WebpackError = unique symbol | "__webpack_error__"; - +/** Keys here can be symbols too, but we can't properly type them */ export type AsyncModulePromise = Promise & { - [WebpackQueues]: (fnQueue: ((queue: any[]) => any)) => any; - [WebpackExports]: ModuleExports; - [WebpackError]?: any; + "__webpack_queues__": (fnQueue: ((queue: any[]) => any)) => any; + "__webpack_exports__": ModuleExports; + "__webpack_error__"?: any; }; export type AsyncModuleBody = ( @@ -152,7 +149,7 @@ export type WebpackRequire = ((moduleId: PropertyKey) => ModuleExports) & { * } * // exports is now { exportName: someExportedValue } (but each value is actually a getter) */ - d: (this: WebpackRequire, exports: AnyRecord, definiton: AnyRecord) => void; + d: (this: WebpackRequire, exports: Record, definiton: Record ModuleExports>) => void; /** The ensure chunk handlers, which are used to ensure the files of the chunks are loaded, or load if necessary */ f: EnsureChunkHandlers; /**