refactor: 增强了tailchat.d.ts的类型声明

pull/49/head
moonrailgun 3 years ago
parent f78b367c55
commit 5e07b02c9c

@ -10,6 +10,7 @@ export {
Table, Table,
Switch, Switch,
Tooltip, Tooltip,
notification,
} from 'antd'; } from 'antd';
export { Avatar } from 'tailchat-design'; export { Avatar } from 'tailchat-design';
export const TextArea = Input.TextArea; export const TextArea = Input.TextArea;
@ -46,3 +47,4 @@ export { GroupPanelSelector } from '@/components/GroupPanelSelector';
export { Emoji } from '@/components/Emoji'; export { Emoji } from '@/components/Emoji';
export { PortalAdd, PortalRemove } from '@/components/Portal'; export { PortalAdd, PortalRemove } from '@/components/Portal';
export { ErrorBoundary } from '@/components/ErrorBoundary'; export { ErrorBoundary } from '@/components/ErrorBoundary';
export { UserName } from '@/components/UserName';

@ -46,8 +46,9 @@ export async function getUserJWT(): Promise<string> {
} }
export interface JWTUserInfoData { export interface JWTUserInfoData {
_id?: string;
nickname?: string; nickname?: string;
uuid?: string; email?: string;
avatar?: string; avatar?: string;
} }
/** /**

39
web/tailchat.d.ts vendored

@ -51,7 +51,12 @@ declare module '@capital/common' {
export const getGlobalState: any; export const getGlobalState: any;
export const getJWTUserInfo: any; export const getJWTUserInfo: () => Promise<{
_id?: string;
nickname?: string;
email?: string;
avatar?: string;
}>;
export const dataUrlToFile: any; export const dataUrlToFile: any;
@ -65,7 +70,17 @@ declare module '@capital/common' {
export const getServiceUrl: () => string; export const getServiceUrl: () => string;
export const getCachedUserInfo: any; export const getCachedUserInfo: (
userId: string,
refetch?: boolean
) => Promise<{
_id: string;
email: string;
nickname: string;
discriminator: string;
avatar: string | null;
temporary: boolean;
}>;
export const getCachedConverseInfo: any; export const getCachedConverseInfo: any;
@ -107,7 +122,10 @@ declare module '@capital/common' {
export const useCurrentUserInfo: any; export const useCurrentUserInfo: any;
export const createPluginRequest: any; export const createPluginRequest: (pluginName: string) => {
get: (actionName: string, config?: any) => Promise<any>;
post: (actionName: string, data?: any, config?: any) => Promise<any>;
};
export const postRequest: any; export const postRequest: any;
@ -137,7 +155,10 @@ declare module '@capital/common' {
export const regChatInputAction: any; export const regChatInputAction: any;
export const regSocketEventListener: any; export const regSocketEventListener: (item: {
eventName: string;
eventFn: (...args: any[]) => void;
}) => void;
export const pluginColorScheme: any; export const pluginColorScheme: any;
@ -182,6 +203,11 @@ declare module '@capital/component' {
export const Tooltip: any; export const Tooltip: any;
/**
* @link https://ant.design/components/notification-cn/
*/
export const notification: any;
export const Avatar: any; export const Avatar: any;
export const TextArea: any; export const TextArea: any;
@ -237,4 +263,9 @@ declare module '@capital/component' {
export const PortalRemove: any; export const PortalRemove: any;
export const ErrorBoundary: any; export const ErrorBoundary: any;
export const UserName: React.FC<{
userId: string;
className?: string;
}>;
} }

Loading…
Cancel
Save