Fix lib typings with errors
This commit is contained in:
parent
1f67203183
commit
1f0635ffc8
6 changed files with 14 additions and 18 deletions
|
@ -29,7 +29,7 @@ export type GenericStore = t.FluxStore & Record<string, any>;
|
|||
|
||||
export const DraftType = findByPropsLazy("ChannelMessage", "SlashCommand");
|
||||
|
||||
export let MessageStore: Omit<Stores.MessageStore, "getMessages"> & {
|
||||
export let MessageStore: Omit<Stores.MessageStore, "getMessages"> & GenericStore & {
|
||||
getMessages(chanId: string): any;
|
||||
};
|
||||
|
||||
|
|
2
src/webpack/common/types/components.d.ts
vendored
2
src/webpack/common/types/components.d.ts
vendored
|
@ -496,7 +496,7 @@ export type Avatar = ComponentType<PropsWithChildren<{
|
|||
}>>;
|
||||
|
||||
type FocusLock = ComponentType<PropsWithChildren<{
|
||||
containerRef: RefObject<HTMLElement>;
|
||||
containerRef: Ref<HTMLElement>;
|
||||
}>>;
|
||||
|
||||
export type Icon = ComponentType<JSX.IntrinsicElements["svg"] & {
|
||||
|
|
3
src/webpack/common/types/stores.d.ts
vendored
3
src/webpack/common/types/stores.d.ts
vendored
|
@ -16,7 +16,6 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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 = <T>(
|
||||
stores: t.FluxStore[],
|
||||
stores: any[],
|
||||
mapper: () => T,
|
||||
dependencies?: any,
|
||||
isEqual?: (old: T, newer: T) => boolean
|
||||
|
|
|
@ -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],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ function shouldIgnoreValue(value: any) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function makePropertyNonEnumerable(target: Object, key: PropertyKey) {
|
||||
function makePropertyNonEnumerable(target: Record<PropertyKey, any>, key: PropertyKey) {
|
||||
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
||||
if (descriptor == null) return;
|
||||
|
||||
|
@ -499,7 +499,7 @@ export function findExportedComponentLazy<T extends object = any>(...props: Prop
|
|||
});
|
||||
}
|
||||
|
||||
function getAllPropertyNames(object: Object, includeNonEnumerable: boolean) {
|
||||
function getAllPropertyNames(object: Record<PropertyKey, any>, includeNonEnumerable: boolean) {
|
||||
const names = new Set<PropertyKey>();
|
||||
|
||||
const getKeys = includeNonEnumerable ? Object.getOwnPropertyNames : Object.keys;
|
||||
|
|
13
src/webpack/wreq.d.ts
vendored
13
src/webpack/wreq.d.ts
vendored
|
@ -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<ModuleExports> & {
|
||||
[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<PropertyKey, any>, definiton: Record<PropertyKey, () => ModuleExports>) => void;
|
||||
/** The ensure chunk handlers, which are used to ensure the files of the chunks are loaded, or load if necessary */
|
||||
f: EnsureChunkHandlers;
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue