fix: type
parent
2694c179d2
commit
8c3efaae21
|
@ -6,7 +6,7 @@ export interface AppProviderContextProps {
|
|||
isMobile: Ref<boolean>
|
||||
}
|
||||
|
||||
const key: InjectionKey<AppProviderContextProps> = Symbol()
|
||||
const key: InjectionKey<AppProviderContextProps> = Symbol('app-context')
|
||||
|
||||
export function createAppProviderContext(context: AppProviderContextProps) {
|
||||
return createContext<AppProviderContextProps>(context, key)
|
||||
|
|
|
@ -6,7 +6,7 @@ export interface FormContextProps {
|
|||
submitAction: () => Promise<void>
|
||||
}
|
||||
|
||||
const key: InjectionKey<FormContextProps> = Symbol()
|
||||
const key: InjectionKey<FormContextProps> = Symbol('form-context')
|
||||
|
||||
export function createFormContext(context: FormContextProps) {
|
||||
return createContext<FormContextProps>(context, key)
|
||||
|
|
|
@ -5,7 +5,7 @@ export interface ModalContextProps {
|
|||
redoModalHeight: () => void
|
||||
}
|
||||
|
||||
const key: InjectionKey<ModalContextProps> = Symbol()
|
||||
const key: InjectionKey<ModalContextProps> = Symbol('modal-context')
|
||||
|
||||
export function createModalContext(context: ModalContextProps) {
|
||||
return createContext<ModalContextProps>(context, key)
|
||||
|
|
|
@ -7,7 +7,7 @@ export interface SimpleRootMenuContextProps {
|
|||
activeName: Ref<string | number>
|
||||
}
|
||||
|
||||
const key: InjectionKey<SimpleRootMenuContextProps> = Symbol()
|
||||
const key: InjectionKey<SimpleRootMenuContextProps> = Symbol('simple-menu-context')
|
||||
|
||||
export function createSimpleRootMenuContext(context: SimpleRootMenuContextProps) {
|
||||
return createContext<SimpleRootMenuContextProps>(context, key, { readonly: false, native: true })
|
||||
|
|
|
@ -7,7 +7,7 @@ export interface PageContextProps {
|
|||
setPageHeight: (height: number) => Promise<void>
|
||||
}
|
||||
|
||||
const key: InjectionKey<PageContextProps> = Symbol()
|
||||
const key: InjectionKey<PageContextProps> = Symbol('page-context')
|
||||
|
||||
export function createPageContext(context: PageContextProps) {
|
||||
return createContext<PageContextProps>(context, key, { native: true })
|
||||
|
|
|
@ -11,7 +11,7 @@ type ShallowUnwrap<T> = {
|
|||
[P in keyof T]: UnwrapRef<T[P]>
|
||||
}
|
||||
|
||||
export function createContext<T>(context: any, key: InjectionKey<T> = Symbol(), options: CreateContextOptions = {}) {
|
||||
export function createContext<T>(context: any, key: InjectionKey<T> = Symbol('create-context'), options: CreateContextOptions = {}) {
|
||||
const { readonly = true, createProvider = true, native = false } = options
|
||||
|
||||
const state = reactive(context)
|
||||
|
@ -25,6 +25,6 @@ export function createContext<T>(context: any, key: InjectionKey<T> = Symbol(),
|
|||
|
||||
export function useContext<T>(key: InjectionKey<T>, native?: boolean): T
|
||||
|
||||
export function useContext<T>(key: InjectionKey<T> = Symbol(), defaultValue?: any): ShallowUnwrap<T> {
|
||||
export function useContext<T>(key: InjectionKey<T> = Symbol('use-context'), defaultValue?: any): ShallowUnwrap<T> {
|
||||
return inject(key, defaultValue || {})
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ export interface ContentContextProps {
|
|||
setPageHeight: (height: number) => Promise<void>
|
||||
}
|
||||
|
||||
const key: InjectionKey<ContentContextProps> = Symbol()
|
||||
const key: InjectionKey<ContentContextProps> = Symbol('content-context')
|
||||
|
||||
export function createContentContext(context: ContentContextProps) {
|
||||
return createContext<ContentContextProps>(context, key, { native: true })
|
||||
|
|
|
@ -8,7 +8,7 @@ import { getRawRoute } from '@/utils'
|
|||
|
||||
const emitter = mitt()
|
||||
|
||||
const key = Symbol()
|
||||
const key = Symbol('route-change')
|
||||
|
||||
let lastChangeTab: RouteLocationNormalized
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ export function getSlot(slots: Slots, slot = 'default', data?: any, opts?: Rende
|
|||
export function extendSlots(slots: Slots, excludeKeys: string[] = []) {
|
||||
const slotKeys = Object.keys(slots)
|
||||
const ret: any = {}
|
||||
// eslint-disable-next-line array-callback-return
|
||||
slotKeys.map((key) => {
|
||||
if (excludeKeys.includes(key))
|
||||
return null
|
||||
|
|
|
@ -266,7 +266,7 @@ export class VAxios {
|
|||
.then((res: AxiosResponse<Result>) => {
|
||||
resolve(res as unknown as Promise<T>)
|
||||
// download file
|
||||
if (typeof res != undefined)
|
||||
if (typeof res != 'undefined')
|
||||
downloadByData(res?.data as unknown as BlobPart, title || 'export')
|
||||
})
|
||||
.catch((e: Error | AxiosError) => {
|
||||
|
@ -309,7 +309,7 @@ export class VAxios {
|
|||
.then((res: AxiosResponse<Result>) => {
|
||||
resolve(res as unknown as Promise<T>)
|
||||
// download file
|
||||
if (typeof res != undefined)
|
||||
if (typeof res != 'undefined')
|
||||
downloadByData(res?.data as unknown as BlobPart, title)
|
||||
})
|
||||
.catch((e: Error | AxiosError) => {
|
||||
|
|
|
@ -122,6 +122,7 @@ const transform: AxiosTransform = {
|
|||
let url = `${config.url}?`
|
||||
for (const propName of Object.keys(params)) {
|
||||
const value = params[propName]
|
||||
// eslint-disable-next-line no-void
|
||||
if (value !== void 0 && value !== null && typeof value !== 'undefined') {
|
||||
if (typeof value === 'object') {
|
||||
for (const val of Object.keys(value)) {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||
const toString = Object.prototype.toString
|
||||
|
||||
export function is(val: unknown, type: string) {
|
||||
|
@ -57,7 +58,7 @@ export function isString(val: unknown): val is string {
|
|||
return is(val, 'String')
|
||||
}
|
||||
|
||||
export function isFunction(val: unknown): val is Function {
|
||||
export function isFunction(val: unknown): val is Fn {
|
||||
return typeof val === 'function'
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable array-callback-return */
|
||||
/**
|
||||
* copy to https://github.com/developit/mitt
|
||||
* Expand clear method
|
||||
|
|
|
@ -6,10 +6,10 @@ import type { ExtractPropTypes } from 'vue'
|
|||
import type { Mutable } from './types'
|
||||
import { isObject } from '@/utils/is'
|
||||
|
||||
const wrapperKey = Symbol()
|
||||
const wrapperKey = Symbol('wrapperKey')
|
||||
export interface PropWrapper<T> { [wrapperKey]: T }
|
||||
|
||||
export const propKey = Symbol()
|
||||
export const propKey = Symbol('propKey')
|
||||
|
||||
type ResolveProp<T> = ExtractPropTypes<{
|
||||
key: { type: T; required: true }
|
||||
|
|
Loading…
Reference in New Issue