refactor: API类型声明优化调整

Former-commit-id: 0ae696c2e872fa90feba0c5df9a92391c02d3e0b
This commit is contained in:
haoxr
2022-11-08 22:53:42 +08:00
parent 94b93f02a1
commit b39ff7b1f6
38 changed files with 468 additions and 513 deletions

9
types/components.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// 全局组件类型声明
import Pagination from '@/components/Pagination/index.vue';
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Pagination: typeof Pagination;
}
}
export {};

19
types/env.d.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
/// <reference types="vite/client" />
declare module '*.vue' {
import { DefineComponent } from 'vue';
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>;
export default component;
}
// 环境变量 TypeScript的智能提示
interface ImportMetaEnv {
VITE_APP_TITLE: string;
VITE_APP_PORT: string;
VITE_APP_BASE_API: string;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
}

13
types/global.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
declare global {
interface PageQuery {
pageNum: number;
pageSize: number;
}
interface PageResult<T> {
list: T;
total: number;
}
}
export {};

11
types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,11 @@
declare type DialogType = {
title: string;
visible: boolean;
};
declare type OptionType = {
value: string;
label: string;
checked?: boolean;
children?: OptionType[];
};