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