ソースを参照

♻️ refactor(file): 优化文件类型定义

- 在file.entity.ts中导出FileType类型别名
- 更新FileSelector.tsx中的导入语句以使用新的FileType类型
- 统一文件类型引用方式,提高代码一致性
yourname 7 ヶ月 前
コミット
c883ff55e6

+ 1 - 1
src/client/admin/components/FileSelector.tsx

@@ -2,7 +2,7 @@ import React, { useState } from 'react';
 import { Modal, Button, Image, message } from 'antd';
 import { useQuery, useQueryClient } from '@tanstack/react-query';
 import { fileClient } from '@/client/api';
-import type { File as FileType } from '@/server/modules/files/file.entity';
+import type { FileType } from '@/server/modules/files/file.entity';
 import MinioUploader from '@/client/admin/components/MinioUploader';
 
 // 定义重载的 props 类型

+ 3 - 1
src/server/modules/files/file.entity.ts

@@ -169,4 +169,6 @@ export const UpdateFileDto = z.object({
     description: '最后更新时间',
     example: '2023-01-16T14:20:00Z' 
   })
-});
+});
+
+export type FileType = z.infer<typeof FileSchema>