From 367978416cf78564ae39c7efafa08723fec6db15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=B2=E9=B8=BD?= <1020103647@qq.com> Date: Sat, 9 Mar 2024 15:02:29 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20typings=20=E4=B8=8D=E7=94=A8?= =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.cjs | 1 + src/store/user.ts | 1 - src/typings.d.ts | 7 ++++--- src/utils/http.ts | 1 - 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 43df026..c543f7f 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -66,6 +66,7 @@ module.exports = { '@typescript-eslint/no-explicit-any': 'off', 'no-underscore-dangle': 'off', 'no-use-before-define': 'off', + 'no-undef': 'off', }, // eslint-import-resolver-typescript 插件,@see https://www.npmjs.com/package/eslint-import-resolver-typescript settings: { diff --git a/src/store/user.ts b/src/store/user.ts index 9118687..3fa7859 100644 --- a/src/store/user.ts +++ b/src/store/user.ts @@ -1,6 +1,5 @@ import { defineStore } from 'pinia' import { ref } from 'vue' -import { IUserInfo } from '../typings' const initState = { nickname: '', avatar: '' } diff --git a/src/typings.d.ts b/src/typings.d.ts index 910b23a..4bc844a 100644 --- a/src/typings.d.ts +++ b/src/typings.d.ts @@ -1,13 +1,14 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable no-unused-vars */ // 全局要用的类型放到这里 -export type IResData = { +type IResData = { code: number msg: string result: T } -export type IUserInfo = { +type IUserInfo = { nickname?: string avatar?: string /** 微信的 openid,非微信没有这个字段 */ @@ -15,7 +16,7 @@ export type IUserInfo = { token?: string } -export enum TestEnum { +enum TestEnum { A = 'a', B = 'b', } diff --git a/src/utils/http.ts b/src/utils/http.ts index 04cd7a4..9ee39c8 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -1,7 +1,6 @@ /* eslint-disable no-param-reassign */ import qs from 'qs' import { useUserStore } from '@/store' -import { IResData, IUserInfo } from '@/typings' type CustomRequestOptions = UniApp.RequestOptions & { query?: Record }