- 新增 tsconfig.json 配置 - 新增 types/ 目录(7个类型定义文件,与后端 DTO 对齐) - 迁移 vite.config.js → vite.config.ts - 迁移 main.js → main.ts - 迁移 utils/api.js → utils/api.ts(泛型化请求封装) - 迁移 utils/currency.js → utils/currency.ts - 迁移 6 个 Vue 页面组件(添加 lang="ts" 和类型注解) - 新增 TYPESCRIPT_MIGRATION.md 迁移计划文档 - 更新 todo.md 进度 收益:完整类型提示、编译时错误检查、重构安全性提升
45 lines
736 B
TypeScript
45 lines
736 B
TypeScript
/// <reference types="@dcloudio/types" />
|
|
|
|
/**
|
|
* 全局类型声明
|
|
*/
|
|
|
|
// 扩展 uni-app 全局类型
|
|
declare global {
|
|
namespace UniNamespace {
|
|
interface GetStorageOption {
|
|
key: string;
|
|
success?: (res: { data: any }) => void;
|
|
fail?: (res: { errMsg: string }) => void;
|
|
complete?: () => void;
|
|
}
|
|
}
|
|
}
|
|
|
|
// 微信小程序登录响应
|
|
interface WechatLoginResponse {
|
|
code: number;
|
|
message: string;
|
|
data: {
|
|
token: string;
|
|
userId: string;
|
|
};
|
|
}
|
|
|
|
// 分页请求参数
|
|
interface PaginationParams {
|
|
page?: number;
|
|
pageSize?: number;
|
|
}
|
|
|
|
// 分页响应
|
|
interface PaginatedResponse<T> {
|
|
items: T[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
totalPages: number;
|
|
}
|
|
|
|
export {};
|