feat: 修改类型定义

This commit is contained in:
fonghehe 2022-07-21 12:20:49 +08:00
parent fd28e0515d
commit 34da551fee
16 changed files with 490 additions and 489 deletions

View File

@ -15,7 +15,7 @@ module.exports = {
jsx: true,
},
},
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'prettier', 'plugin:prettier/recommended'],
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
rules: {
'vue/script-setup-uses-vars': 'error',
'@typescript-eslint/ban-ts-ignore': 'off',

View File

@ -1 +1,9 @@
export const IsReport = process.env.REPORT;
export const API_BASE_URL = '';
export const MOCK_API_BASE_URL = '';
export const API_TARGET_URL = '';
export const MOCK_API_TARGET_URL = '';

View File

@ -74,7 +74,7 @@
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vue-eslint-parser": "^9.0.3",
"vue-tsc": "^0.38.8"
"vue-tsc": "^0.38.9"
},
"husky": {
"hooks": {

View File

@ -1,9 +1,8 @@
import { AnyObject } from '/#/global';
import { createI18n } from 'vue-i18n';
export function loadLang() {
const modules: Record<string, any> = import.meta.glob('./lang/*.ts', { eager: true });
const langs: AnyObject = {};
const langs: Record<string, any> = {};
for (const path in modules) {
const name = path.replace(/(\.\/lang\/|\.ts)/g, '');

View File

@ -2,14 +2,13 @@ import { loginPassword } from '/@/api';
import { useCookies } from '@vueuse/integrations/useCookies';
import { defineStore } from 'pinia';
import { watch } from 'vue';
import { AnyObject } from '/#/global';
const { VITE_TOKEN_KEY } = import.meta.env;
const token = useCookies().get(VITE_TOKEN_KEY as string);
interface StoreUser {
token: string;
info: AnyObject;
info: Record<any, any>;
}
export const useUserStore = defineStore({

View File

@ -1,5 +1,3 @@
import { AnyObject } from '/#/global';
export function typeCheck(param: any) {
return Object.prototype.toString.call(param);
}
@ -7,7 +5,7 @@ export function typeCheck(param: any) {
/**
* stage
*/
export function mutateState(state: AnyObject, payload: AnyObject) {
export function mutateState(state: Record<string, any>, payload: Record<string, any>) {
if (typeCheck(state) === '[object Object]' && typeCheck(payload) === '[object Object]') {
for (const key in payload) {
state[key] = payload[key];

View File

@ -35,8 +35,8 @@
"src/**/*.vue",
"types/**/*.d.ts",
"types/**/*.ts",
"build/**/*.ts",
"build/**/*.d.ts",
"config/**/*.ts",
"config/**/*.d.ts",
"mock/**/*.ts",
"vite.config.ts"
],

1
types/config.d.ts vendored
View File

@ -16,6 +16,7 @@ export interface MenuSetting {
bgColor: string;
fixed: boolean;
collapsed: boolean;
siderHidden: boolean;
canDrag: boolean;
show: boolean;
hidden: boolean;

4
types/global.d.ts vendored
View File

@ -87,10 +87,6 @@ declare global {
}
}
export interface AnyObject {
[key: string]: any;
}
declare module 'vue' {
export type JSXComponent<Props = any> = { new (): ComponentPublicInstance<Props> } | FunctionalComponent<Props>;
}

View File

@ -919,37 +919,37 @@
resolved "https://registry.yarnpkg.com/@vitejs/plugin-vue/-/plugin-vue-3.0.1.tgz#b6af8f782485374bbb5fe09edf067a845bf4caae"
integrity sha512-Ll9JgxG7ONIz/XZv3dssfoMUDu9qAnlJ+km+pBA0teYSXzwPCIzS/e1bmwNYl5dcQGs677D21amgfYAnzMl17A==
"@volar/code-gen@0.38.8":
version "0.38.8"
resolved "https://registry.yarnpkg.com/@volar/code-gen/-/code-gen-0.38.8.tgz#ea50a742983f9fd8c3fc23d61497387c520776c9"
integrity sha512-e37jd+JwNjBpWiBblsdmYMbJ9bELiuj2yZrsXv1IVKpYNSfvS92ZiYjJqVXHUwpzNeZjFG0RCd5nTpbiebwANw==
"@volar/code-gen@0.38.9":
version "0.38.9"
resolved "https://registry.yarnpkg.com/@volar/code-gen/-/code-gen-0.38.9.tgz#8fed2c6a472c8f11ce695b08789bcc22b08e7fa6"
integrity sha512-n6LClucfA+37rQeskvh9vDoZV1VvCVNy++MAPKj2dT4FT+Fbmty/SDQqnsEBtdEe6E3OQctFvA/IcKsx3Mns0A==
dependencies:
"@volar/source-map" "0.38.8"
"@volar/source-map" "0.38.9"
"@volar/source-map@0.38.8":
version "0.38.8"
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-0.38.8.tgz#13b2fc9234f78fada3c78fd235f446cfaaa7d0b8"
integrity sha512-JZvpjW/z2U3wq5wvwcTounPrRAZuSl4hlVKr3y7y72bKr++6W05OnX7fl/ddw39G/wLHdI2ag5+4JWsSd/EYhg==
"@volar/source-map@0.38.9":
version "0.38.9"
resolved "https://registry.yarnpkg.com/@volar/source-map/-/source-map-0.38.9.tgz#935d6def4b4342e8e2d63cd8e6bf9bf1155c58d8"
integrity sha512-ba0UFoHDYry+vwKdgkWJ6xlQT+8TFtZg1zj9tSjj4PykW1JZDuM0xplMotLun4h3YOoYfY9K1huY5gvxmrNLIw==
"@volar/vue-code-gen@0.38.8":
version "0.38.8"
resolved "https://registry.yarnpkg.com/@volar/vue-code-gen/-/vue-code-gen-0.38.8.tgz#e7b719194ef40d76093191cf4bb83c96134fed32"
integrity sha512-iQVNmIu1TqnqTko+l9yeylmZipZ8zNH20XZAK9+48hkv2fEQnnJn5AI2W9Zb2M5DkGMpbYiJk9Fq1vm51YY1+g==
"@volar/vue-code-gen@0.38.9":
version "0.38.9"
resolved "https://registry.yarnpkg.com/@volar/vue-code-gen/-/vue-code-gen-0.38.9.tgz#878f00fec82a2fc300396d70e26b0ea29952f740"
integrity sha512-tzj7AoarFBKl7e41MR006ncrEmNPHALuk8aG4WdDIaG387X5//5KhWC5Ff3ZfB2InGSeNT+CVUd74M0gS20rjA==
dependencies:
"@volar/code-gen" "0.38.8"
"@volar/source-map" "0.38.8"
"@volar/code-gen" "0.38.9"
"@volar/source-map" "0.38.9"
"@vue/compiler-core" "^3.2.37"
"@vue/compiler-dom" "^3.2.37"
"@vue/shared" "^3.2.37"
"@volar/vue-typescript@0.38.8":
version "0.38.8"
resolved "https://registry.yarnpkg.com/@volar/vue-typescript/-/vue-typescript-0.38.8.tgz#5412a8b38d404a72aa37902ad87ccd3dc0c7f1f1"
integrity sha512-7WeFt5piz9I6FKw2cQQCWm+75MxS6xCOGm300iu+hJORlroN2dwWbwj97pQnDGbjQbftCRplUYf0GqmhcOsanQ==
"@volar/vue-typescript@0.38.9":
version "0.38.9"
resolved "https://registry.yarnpkg.com/@volar/vue-typescript/-/vue-typescript-0.38.9.tgz#e5dfdc6f0d6dbea683647cd477fafbd483983b35"
integrity sha512-iJMQGU91ADi98u8V1vXd2UBmELDAaeSP0ZJaFjwosClQdKlJQYc6MlxxKfXBZisHqfbhdtrGRyaryulnYtliZw==
dependencies:
"@volar/code-gen" "0.38.8"
"@volar/source-map" "0.38.8"
"@volar/vue-code-gen" "0.38.8"
"@volar/code-gen" "0.38.9"
"@volar/source-map" "0.38.9"
"@volar/vue-code-gen" "0.38.9"
"@vue/compiler-sfc" "^3.2.37"
"@vue/reactivity" "^3.2.37"
@ -7822,12 +7822,12 @@ vue-router@^4.1.2:
dependencies:
"@vue/devtools-api" "^6.1.4"
vue-tsc@^0.38.8:
version "0.38.8"
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-0.38.8.tgz#becf3dddd3c57784c79206aa1d5be750e8bca319"
integrity sha512-hhyc5SODiekcYNXG08aNg17LogR19o3i14avVejo+Fm45Dqk9Ke6rb0M19HoTKdQGfZBgqg2VUboYxmtAukWeg==
vue-tsc@^0.38.9:
version "0.38.9"
resolved "https://registry.yarnpkg.com/vue-tsc/-/vue-tsc-0.38.9.tgz#9e945937667f704325328db8af1cc6bc7314b85e"
integrity sha512-Yoy5phgvGqyF98Fb4mYqboR4Q149jrdcGv5kSmufXJUq++RZJ2iMVG0g6zl+v3t4ORVWkQmRpsV4x2szufZ0LQ==
dependencies:
"@volar/vue-typescript" "0.38.8"
"@volar/vue-typescript" "0.38.9"
vue@^3.2.36:
version "3.2.37"