mirror of
				https://gitee.com/vant-contrib/vant.git
				synced 2025-10-31 03:22:08 +08:00 
			
		
		
		
	types: reduce any (#9731)
This commit is contained in:
		
							parent
							
								
									8a97278cda
								
							
						
					
					
						commit
						f6c70a9a49
					
				| @ -39,7 +39,7 @@ export type CalendarMonthInstance = ComponentPublicInstance< | |||||||
|   CalendarMonthProps, |   CalendarMonthProps, | ||||||
|   { |   { | ||||||
|     showed?: boolean; |     showed?: boolean; | ||||||
|     getTitle: () => any; |     getTitle: () => string; | ||||||
|     getHeight: () => number; |     getHeight: () => number; | ||||||
|     setVisible: (value?: boolean | undefined) => void; |     setVisible: (value?: boolean | undefined) => void; | ||||||
|     scrollIntoView: (body: Element) => void; |     scrollIntoView: (body: Element) => void; | ||||||
|  | |||||||
| @ -139,9 +139,12 @@ Toast.clear = (all?: boolean) => { | |||||||
| 
 | 
 | ||||||
| function setDefaultOptions(options: ToastOptions): void; | function setDefaultOptions(options: ToastOptions): void; | ||||||
| function setDefaultOptions(type: ToastType, options: ToastOptions): void; | function setDefaultOptions(type: ToastType, options: ToastOptions): void; | ||||||
| function setDefaultOptions(type: ToastType | ToastOptions, options?: any) { | function setDefaultOptions( | ||||||
|  |   type: ToastType | ToastOptions, | ||||||
|  |   options?: ToastOptions | ||||||
|  | ) { | ||||||
|   if (typeof type === 'string') { |   if (typeof type === 'string') { | ||||||
|     defaultOptionsMap.set(type, options); |     defaultOptionsMap.set(type, options!); | ||||||
|   } else { |   } else { | ||||||
|     extend(currentOptions, type); |     extend(currentOptions, type); | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -6,7 +6,7 @@ import locale from '../locale'; | |||||||
| export function createTranslate(name: string) { | export function createTranslate(name: string) { | ||||||
|   const prefix = camelize(name) + '.'; |   const prefix = camelize(name) + '.'; | ||||||
| 
 | 
 | ||||||
|   return (path: string, ...args: any[]): any => { |   return (path: string, ...args: unknown[]): string => { | ||||||
|     const messages = locale.messages(); |     const messages = locale.messages(); | ||||||
|     const message = get(messages, prefix + path) || get(messages, path); |     const message = get(messages, prefix + path) || get(messages, path); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| import { isDef, isObject } from './validate'; | import { isDef, isObject } from './validate'; | ||||||
| 
 | 
 | ||||||
| type ObjectIndex = Record<string, any>; | type ObjectIndex = Record<string, unknown>; | ||||||
| 
 | 
 | ||||||
| const { hasOwnProperty } = Object.prototype; | const { hasOwnProperty } = Object.prototype; | ||||||
| 
 | 
 | ||||||
| @ -15,7 +15,7 @@ function assignKey(to: ObjectIndex, from: ObjectIndex, key: string) { | |||||||
|     to[key] = val; |     to[key] = val; | ||||||
|   } else { |   } else { | ||||||
|     // eslint-disable-next-line no-use-before-define
 |     // eslint-disable-next-line no-use-before-define
 | ||||||
|     to[key] = deepAssign(Object(to[key]), from[key]); |     to[key] = deepAssign(Object(to[key]), val); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| import { isDef } from './validate'; | import { isDef, isObject } from './validate'; | ||||||
| 
 | 
 | ||||||
| export function deepClone<T extends Record<string, any> | null | undefined>( | export function deepClone<T extends Record<string, any> | null | undefined>( | ||||||
|   obj: T |   obj: T | ||||||
| @ -11,7 +11,7 @@ export function deepClone<T extends Record<string, any> | null | undefined>( | |||||||
|     return obj.map((item) => deepClone(item)) as unknown as T; |     return obj.map((item) => deepClone(item)) as unknown as T; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if (typeof obj === 'object') { |   if (isObject(obj)) { | ||||||
|     const to = {} as Record<string, any>; |     const to = {} as Record<string, any>; | ||||||
|     Object.keys(obj).forEach((key) => { |     Object.keys(obj).forEach((key) => { | ||||||
|       to[key] = deepClone(obj[key]); |       to[key] = deepClone(obj[key]); | ||||||
|  | |||||||
| @ -1,7 +1,7 @@ | |||||||
| import { noop } from './basic'; | import { noop } from './basic'; | ||||||
| import { isPromise } from './validate'; | import { isPromise } from './validate'; | ||||||
| 
 | 
 | ||||||
| export type Interceptor = (...args: any[]) => Promise<boolean> | boolean; | export type Interceptor = (...args: unknown[]) => Promise<boolean> | boolean; | ||||||
| 
 | 
 | ||||||
| export function callInterceptor( | export function callInterceptor( | ||||||
|   interceptor: Interceptor | undefined, |   interceptor: Interceptor | undefined, | ||||||
| @ -10,7 +10,7 @@ export function callInterceptor( | |||||||
|     done, |     done, | ||||||
|     canceled, |     canceled, | ||||||
|   }: { |   }: { | ||||||
|     args?: any[]; |     args?: unknown[]; | ||||||
|     done: () => void; |     done: () => void; | ||||||
|     canceled?: () => void; |     canceled?: () => void; | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ export type WithInstall<T> = T & { | |||||||
| 
 | 
 | ||||||
| export function withInstall<T>(options: T) { | export function withInstall<T>(options: T) { | ||||||
|   (options as Record<string, unknown>).install = (app: App) => { |   (options as Record<string, unknown>).install = (app: App) => { | ||||||
|     const { name } = options as any; |     const { name } = options as unknown as { name: string }; | ||||||
|     app.component(name, options); |     app.component(name, options); | ||||||
|     app.component(camelize(`-${name}`), options); |     app.component(camelize(`-${name}`), options); | ||||||
|   }; |   }; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user