declare module 'slash2'; declare module '*.css'; declare module '*.less'; declare module '*.scss'; declare module '*.sass'; declare module '*.svg'; declare module '*.png'; declare module '*.jpg'; declare module '*.jpeg'; declare module '*.gif'; declare module '*.bmp'; declare module '*.webp'; declare module '*.tiff'; declare module 'omit.js'; declare module 'numeral'; declare module 'mockjs'; declare module 'react-fittext'; // CAP widget type declarations declare module '@cap.js/widget' { export interface CapWidgetElement extends HTMLElement { verify: () => Promise<{ token: string }>; reset: () => void; } } declare namespace JSX { interface IntrinsicElements { 'cap-widget': React.DetailedHTMLProps< React.HTMLAttributes & { id?: string; 'data-cap-api-endpoint'?: string; style?: React.CSSProperties; }, HTMLElement >; } } declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false; declare namespace NodeJS { interface ProcessEnv { /** 环境 */ REACT_APP_ENV?: 'test' | 'dev' | 'pre' | 'prod' | false; /** 产品ID */ REACT_APP_ID?: string; /** 产品名称 */ REACT_APP_NAME?: string; /** 产品版本 */ REACT_APP_VERSION?: string; /** 构建时间 */ REACT_APP_BUILD_TIME?: number; /** 存储空间名称 */ STORAGE_NAME_SPACE?: string; /** 是否启用请求加密 */ ENABLE_REQUEST_ENCRYPTION?: boolean; /** 请求加密密钥 */ REQUEST_ENCRYPTION_KEY?: string; /** 是否启用存储加密 */ ENABLE_STORAGE_ENCRYPTION?: boolean; /** 存储加密密钥 */ STORAGE_ENCRYPTION_KEY?: string; /** 管理后台登录密钥(对应服务端 Auth.ManagementKey,由前端透明传递,不在表单中展示) */ REACT_APP_MANAGEMENT_KEY?: string; /** 请求数据压缩方式(nozip / br / gzip),默认 nozip */ REQUEST_DATA_COMPRESSION?: string; /** 接口服务器地址,开发环境下通常与 proxy 配置配合,将请求代理到 REACT_APP_REAL_API_URL 指定的服务器。生产环境下若 接口服务器 与 web服务器 的地址不同,需配置为完整地址 */ REACT_APP_API_URL?: string; } interface DevProcessEnv extends ProcessEnv { /** 接口服务器的实际地址,不要在项目代码中引用,该配置仅在开发环境中才能被 本地代理服务器 成功引用 */ REACT_APP_REAL_API_URL?: string; } } /** * 将 T 中的 K 字段设置为可选,其他字段保持不变 * @example * type User = { id: number; name: string; email?: string }; * type PartialName = PartialFields; * // { id: number; name?: string; email?: string } */ type PartialFields = Partial> & Omit; /** * 将 T 中除了 K 字段外的其他字段设置为可选,K字段保持不变 * @example * type User = { id: number; name: string; email?: string }; * type PartialExceptId = PartialExcept; * // { id: number; name?: string; email?: string } */ type PartialExcept = Partial> & Pick; /** * 将 T 中的 K 字段设置为必需,其他字段保持不变 * @example * type User = { id: number; name?: string; email?: string }; * type RequiredEmail = RequiredFields; * // { id: number; name?: string; email: string } */ type RequiredFields = Required> & Omit; /** * 将 T 中除了 K 字段外的其他字段设置为必须,K字段保持不变 * @example * type User = { id?: number; name?: string; email?: string }; * type RequiredExceptId = RequiredExcept; * // { id?: number; name: string; email: string } */ type RequiredExcept = Required> & Pick; /** * 将 T 中的 K 字段设置为必选,其他字段可选 * @example * type User = { id?: number; name?: string; email?: string }; * type RequiredEmail = RequiredKOptionalOthers; * // { id: number; name?: string; email?: string } */ type RequiredKOptionalOthers = Partial> & Required>; /** * 将 T 中的 K 字段设置为可选,其他字段必须 * @example * type User = { id: number; name?: string; email: string }; * type OptionalEmail = OptionalKRequiredOthers; * // { id: number; name: string; email?: string } */ type OptionalKRequiredOthers = Required> & Partial>; // type Primitive = string | number | boolean | bigint | symbol | undefined | null; // type Builtin = Primitive | ((...args: any[]) => any) | Date | Error | RegExp; // type IsArray = T extends any[] ? true : false; // type IsObject = T extends Builtin // ? false // : T extends ReadonlyArray // ? false // : T extends object // ? true // : false; // type FormFieldPath = T extends object // ? { // [K in keyof T]-?: K extends string // ? // 单层路径:字符串形式 // | K // // 嵌套路径:如果是对象且不是数组 // | (IsObject extends true // ? IsArray extends true // ? never // 不深入数组内部 // : FormFieldPath extends infer SubPaths // ? SubPaths extends string // ? [K, SubPaths] // 二级嵌套 // : SubPaths extends any[] // ? [K, ...SubPaths] // 多级嵌套 // : never // : never // : never) // : never; // }[keyof T] // : never; type FormFieldPath = T extends object ? string | string[] : never; type ErrorShowType = import('@/defines').ErrorShowType; type EditorFormMode = 'edit' | 'add' | 'copy'; declare namespace API { type OPT = { label: string; value: T; [key: string]: any }; type MenuKey = { label: string; key: T; [key: string]: any }; type TabKey = { tab: string; key: T; [key: string]: any }; type Empty = Record; interface Result { success?: boolean; data?: T; errorCode?: number; errorMessage?: string; showType?: ErrorShowType; traceId?: string; host?: string; } type ResultEmpty = Result; type SvrResultList = Result<{ total: number; list: T[]; }>; interface ResultList extends Result { total: number; } interface AntdPageParams { current?: number; pageSize?: number; keyword?: string; [key: string]: any; } interface CommonListReq { ids?: number[]; excludeIds?: number[]; } type ReqList = T & CommonListReq & AntdPageParams; interface SortBy { column: string; asc: boolean; } type SvrReqList = T & { page: number; pageSize: number; sortBy?: string | SortBy | SortBy[]; }; interface ReqDelete { ids: T[]; } interface NumberRange { min?: number; max?: number; } }