/** * 微信小程序全局类型声明 */ /// // ===== Stores 模块类型 ===== declare module '../../stores' { export const authStore: { state: { isLoggedIn: boolean; userId: string | null; phoneBound: boolean; authStatus: string } loginWithWechat: (code: string) => Promise logout: () => Promise } export const userStore: { state: { userState: any; profile: any } hydrate: () => void fetchStatus: () => Promise subscribe: (cb: (state: any) => void) => () => void bindToPage: (page: any, fields: Record) => () => void } export const matchStore: { state: { recommendations: any[]; recState: string; likersCount: number } fetchRecommendations: () => Promise loadMoreRecommendations: () => Promise fetchLikersCount: () => Promise like: (userId: string) => Promise pass: (userId: string) => Promise block: (userId: string, reason?: string) => Promise unmatch: (matchId: string) => Promise confirmSuccess: (matchId: string) => Promise subscribe: (cb: (state: any) => void) => () => void bindToPage: (page: any, fields: Record) => () => void } export const messageStore: { state: { conversations: any[]; currentConversationId: string | null } openConversation: (id: string) => Promise closeConversation: () => void fetchConversations: () => Promise markConversationRead: (id: string) => Promise markConversationBlocked: (id: string) => void onMessage: (convId: string, cb: (msg: any) => void) => () => void subscribe: (cb: (state: any) => void) => () => void bindToPage: (page: any, fields: Record) => () => void } export const appStore: { state: { loading: boolean } init: () => Promise toast: (msg: string) => void toastSuccess: (msg: string) => void toastError: (msg: string, fallback?: string) => void showLoading: (msg?: string) => void hideLoading: () => void confirm: (opts: { title: string; content: string; confirmText: string; danger?: boolean }) => Promise } export const blockUser: (userId: string, reason?: string) => Promise export const likeUser: (userId: string) => Promise } // ===== Constants 模块类型 ===== declare module '../../constants' { export const ROUTE: { TAB: { HOME: string; DISCOVER: string; MESSAGES: string; ACTIVITY: string; MINE: string } MAIN: { DISCOVER: string; FATE_CENTER: string } DETAIL: { PROFILE_DETAIL: string; ACTIVITY_REGISTER: string; MATCHMAKER_APPLY: string; LIKERS: string; MATCHMAKER_PROGRESS: string } REVIEW: { PENDING: string; REJECTED: string; ACCOUNT_STATUS: string } AUTH: { LOGIN: string } } export const to: { detail: (userId: string) => string chat: (convId: string) => string } export const BUSINESS_LIMITS: { MAX_PROFILE_PHOTOS: number } export const RECOMMENDATION_STATE: { IDLE: string; LOADING: string; ERROR: string; EMPTY: string } export const PROFILE_REVIEW: { NOT_SUBMITTED: string; PENDING: string; APPROVED: string; NEED_EDIT: string; REJECTED: string } export const ACCOUNT_STATUS: { NORMAL: string; BANNED: string; SUSPENDED: string } export const DANGER_ACTION: { BLOCK: string; UNMATCH: string } export const BUSINESS_ERROR_CODE: { PROFILE_NOT_APPROVED: string; ACCOUNT_BANNED: string } }