Make commons have proper ProxyInner typing
This commit is contained in:
parent
5edff4a3c5
commit
1b64419ef1
|
@ -42,8 +42,6 @@ export let ScrollerThin: t.ScrollerThin = NoopComponent;
|
||||||
export let Clickable: t.Clickable = NoopComponent;
|
export let Clickable: t.Clickable = NoopComponent;
|
||||||
export let Avatar: t.Avatar = NoopComponent;
|
export let Avatar: t.Avatar = NoopComponent;
|
||||||
export let FocusLock: t.FocusLock = NoopComponent;
|
export let FocusLock: t.FocusLock = NoopComponent;
|
||||||
// token lagger real
|
|
||||||
/** css colour resolver stuff, no clue what exactly this does, just copied usage from Discord */
|
|
||||||
export let useToken: t.useToken;
|
export let useToken: t.useToken;
|
||||||
|
|
||||||
export const MaskedLink = findComponent<t.MaskedLinkProps>(filters.componentByCode("MASKED_LINK)"));
|
export const MaskedLink = findComponent<t.MaskedLinkProps>(filters.componentByCode("MASKED_LINK)"));
|
||||||
|
@ -52,7 +50,7 @@ export const Flex = findComponent<t.FlexProps>(filters.byProps("Justify", "Align
|
||||||
|
|
||||||
export const OAuth2AuthorizeModal = findExportedComponent("OAuth2AuthorizeModal");
|
export const OAuth2AuthorizeModal = findExportedComponent("OAuth2AuthorizeModal");
|
||||||
|
|
||||||
export const Forms = find(filters.byProps("FormItem", "Button"), m => {
|
export const Forms = find<t.Forms>(filters.byProps("FormItem", "Button"), m => {
|
||||||
({
|
({
|
||||||
useToken,
|
useToken,
|
||||||
Card,
|
Card,
|
||||||
|
@ -78,9 +76,4 @@ export const Forms = find(filters.byProps("FormItem", "Button"), m => {
|
||||||
} = m);
|
} = m);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
}) as {
|
});
|
||||||
FormTitle: t.FormTitle,
|
|
||||||
FormSection: t.FormSection,
|
|
||||||
FormDivider: t.FormDivider,
|
|
||||||
FormText: t.FormText,
|
|
||||||
};
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type * as Stores from "discord-types/stores";
|
|
||||||
|
|
||||||
// eslint-disable-next-line path-alias/no-relative
|
// eslint-disable-next-line path-alias/no-relative
|
||||||
import { filters, find, findByProps, findStore } from "../webpack";
|
import { filters, find, findByProps, findStore } from "../webpack";
|
||||||
import * as t from "./types/stores";
|
import * as t from "./types/stores";
|
||||||
|
@ -33,28 +31,22 @@ export enum DraftType {
|
||||||
ApplicationLauncherCommand = 3
|
ApplicationLauncherCommand = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MessageStore = findStore("MessageStore") as Omit<Stores.MessageStore, "getMessages"> & {
|
|
||||||
getMessages(chanId: string): any;
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is not actually a FluxStore
|
// This is not actually a FluxStore
|
||||||
export const PrivateChannelsStore = findByProps("openPrivateChannel");
|
export const PrivateChannelsStore = findByProps("openPrivateChannel");
|
||||||
export const PermissionStore = findStore<GenericStore>("PermissionStore");
|
export const PermissionStore = findStore<GenericStore>("PermissionStore");
|
||||||
export const GuildChannelStore = findStore<GenericStore>("GuildChannelStore");
|
export const GuildChannelStore = findStore<GenericStore>("GuildChannelStore");
|
||||||
export const ReadStateStore = findStore<GenericStore>("ReadStateStore");
|
export const ReadStateStore = findStore<GenericStore>("ReadStateStore");
|
||||||
export const PresenceStore = findStore<GenericStore>("PresenceStore");
|
export const PresenceStore = findStore<GenericStore>("PresenceStore");
|
||||||
|
export const MessageStore = findStore<t.MessageStore>("MessageStore");
|
||||||
|
|
||||||
export const GuildStore = findStore<t.GuildStore>("GuildStore");
|
export const GuildStore = findStore<t.GuildStore>("GuildStore");
|
||||||
export const UserStore = findStore<Stores.UserStore & t.FluxStore>("UserStore");
|
export const UserStore = findStore<t.UserStore>("UserStore");
|
||||||
export const UserProfileStore = findStore<GenericStore>("UserProfileStore");
|
export const UserProfileStore = findStore<GenericStore>("UserProfileStore");
|
||||||
export const SelectedChannelStore = findStore<Stores.SelectedChannelStore & t.FluxStore>("SelectedChannelStore");
|
export const SelectedChannelStore = findStore<t.SelectedChannelStore>("SelectedChannelStore");
|
||||||
export const SelectedGuildStore = findStore<GenericStore>("SelectedGuildStore");
|
export const SelectedGuildStore = findStore<GenericStore>("SelectedGuildStore");
|
||||||
export const ChannelStore = findStore<Stores.ChannelStore & t.FluxStore>("ChannelStore");
|
export const ChannelStore = findStore<t.ChannelStore>("ChannelStore");
|
||||||
export const GuildMemberStore = findStore<Stores.GuildMemberStore & t.FluxStore>("GuildMemberStore");
|
export const GuildMemberStore = findStore<t.GuildMemberStore>("GuildMemberStore");
|
||||||
export const RelationshipStore = findStore("RelationshipStore") as Stores.RelationshipStore & t.FluxStore & {
|
export const RelationshipStore = findStore<t.RelationshipStore>("RelationshipStore");
|
||||||
/** Get the date (as a string) that the relationship was created */
|
|
||||||
getSince(userId: string): string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const EmojiStore = findStore<t.EmojiStore>("EmojiStore");
|
export const EmojiStore = findStore<t.EmojiStore>("EmojiStore");
|
||||||
export const WindowStore = findStore<t.WindowStore>("WindowStore");
|
export const WindowStore = findStore<t.WindowStore>("WindowStore");
|
||||||
|
|
7
src/webpack/common/types/components.d.ts
vendored
7
src/webpack/common/types/components.d.ts
vendored
|
@ -68,6 +68,13 @@ export type FormText = ComponentType<PropsWithChildren<{
|
||||||
type?: string;
|
type?: string;
|
||||||
}> & TextProps> & { Types: FormTextTypes; };
|
}> & TextProps> & { Types: FormTextTypes; };
|
||||||
|
|
||||||
|
type Forms = {
|
||||||
|
FormTitle: t.FormTitle,
|
||||||
|
FormSection: t.FormSection,
|
||||||
|
FormDivider: t.FormDivider,
|
||||||
|
FormText: t.FormText,
|
||||||
|
};
|
||||||
|
|
||||||
export type Tooltip = ComponentType<{
|
export type Tooltip = ComponentType<{
|
||||||
text: ReactNode;
|
text: ReactNode;
|
||||||
children: FunctionComponent<{
|
children: FunctionComponent<{
|
||||||
|
|
15
src/webpack/common/types/stores.d.ts
vendored
15
src/webpack/common/types/stores.d.ts
vendored
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import { DraftType } from "@webpack/common";
|
import { DraftType } from "@webpack/common";
|
||||||
import { Channel, Guild, Role } from "discord-types/general";
|
import { Channel, Guild, Role } from "discord-types/general";
|
||||||
|
import type * as Stores from "discord-types/stores";
|
||||||
|
|
||||||
import { FluxDispatcher, FluxEvents } from "./utils";
|
import { FluxDispatcher, FluxEvents } from "./utils";
|
||||||
|
|
||||||
|
@ -183,6 +184,20 @@ export class GuildStore extends FluxStore {
|
||||||
getAllGuildRoles(): Record<string, Record<string, Role>>;
|
getAllGuildRoles(): Record<string, Record<string, Role>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MessageStore = t.FluxStore & Omit<Stores.MessageStore, "getMessages"> & {
|
||||||
|
getMessages(channelId: string): any;
|
||||||
|
};
|
||||||
|
|
||||||
|
type UserStore = t.FluxStore & Stores.UserStore;
|
||||||
|
type SelectedChannelStore = t.FluxStore & Stores.SelectedChannelStore;
|
||||||
|
type ChannelStore = t.FluxStore & Stores.ChannelStore;
|
||||||
|
type GuildMemberStore = t.FluxStore & Stores.GuildMemberStore;
|
||||||
|
|
||||||
|
type RelationshipStore = t.FluxStore & Stores.RelationshipStore & {
|
||||||
|
/** Get the date (as a string) that the relationship was created */
|
||||||
|
getSince(userId: string): string;
|
||||||
|
};
|
||||||
|
|
||||||
export type useStateFromStores = <T>(
|
export type useStateFromStores = <T>(
|
||||||
stores: t.FluxStore[],
|
stores: t.FluxStore[],
|
||||||
mapper: () => T,
|
mapper: () => T,
|
||||||
|
|
15
src/webpack/common/types/utils.d.ts
vendored
15
src/webpack/common/types/utils.d.ts
vendored
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Guild, GuildMember } from "discord-types/general";
|
import { Channel, Guild, GuildMember, User } from "discord-types/general";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
import type { FluxEvents } from "./fluxEvents";
|
import type { FluxEvents } from "./fluxEvents";
|
||||||
|
@ -227,3 +227,16 @@ export interface IconUtils {
|
||||||
getApplicationIconSource: any;
|
getApplicationIconSource: any;
|
||||||
getAnimatableSourceWithFallback: any;
|
getAnimatableSourceWithFallback: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface UserUtils {
|
||||||
|
getUser: (id: string) => Promise<User>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UploadHandler {
|
||||||
|
promptToUpload: (files: File[], channel: Channel, draftType: Number) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ApplicationAssetUtils {
|
||||||
|
fetchAssetIds: (applicationId: string, e: string[]) => Promise<string[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { Channel, User } from "discord-types/general";
|
|
||||||
|
|
||||||
// eslint-disable-next-line path-alias/no-relative
|
// eslint-disable-next-line path-alias/no-relative
|
||||||
import { _resolveReady, filters, find, findByCode, findByProps, waitFor } from "../webpack";
|
import { _resolveReady, filters, find, findByCode, findByProps, waitFor } from "../webpack";
|
||||||
import type * as t from "./types/utils";
|
import type * as t from "./types/utils";
|
||||||
|
@ -108,14 +106,10 @@ export function showToast(message: string, type = ToastType.MESSAGE) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UserUtils = findByProps("getUser", "fetchCurrentUser") as { getUser: (id: string) => Promise<User>; };
|
export const UserUtils = findByProps<t.UserUtils>("getUser", "fetchCurrentUser");
|
||||||
export const UploadHandler = findByProps("showUploadFileSizeExceededError", "promptToUpload") as {
|
export const UploadHandler = findByProps<t.UploadHandler>("showUploadFileSizeExceededError", "promptToUpload");
|
||||||
promptToUpload: (files: File[], channel: Channel, draftType: Number) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const ApplicationAssetUtils = findByProps("fetchAssetIds", "getAssetImage") as {
|
export const ApplicationAssetUtils = findByProps<t.ApplicationAssetUtils>("fetchAssetIds", "getAssetImage");
|
||||||
fetchAssetIds: (applicationId: string, e: string[]) => Promise<string[]>;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const Clipboard = findByProps<t.Clipboard>("SUPPORTS_COPY", "copy");
|
export const Clipboard = findByProps<t.Clipboard>("SUPPORTS_COPY", "copy");
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue