From bfd1f486cdc5158108a333f725e2c79446cc24c6 Mon Sep 17 00:00:00 2001 From: sunhao Date: Wed, 28 Aug 2024 19:43:57 +0800 Subject: [PATCH] * core: refactor size helpers types. --- lib/core/src/helpers/size.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/src/helpers/size.ts b/lib/core/src/helpers/size.ts index 1d653c33e9..f40501d3f5 100644 --- a/lib/core/src/helpers/size.ts +++ b/lib/core/src/helpers/size.ts @@ -1,8 +1,8 @@ -export type SizeSetting = number | `${number}%` | `${number}px` | `${number}/${number}` | (string & {}) | ((...args: unknown[]) => SizeSetting); +export type SizeSetting = number | `${number}%` | `${number}px` | `${number}/${number}` | (string & {}) | ((...args: A) => SizeSetting); -export function parseSize(size: SizeSetting, callbackArgs: unknown[] = []): [value: number, type?: 'px' | '%'] { +export function parseSize(size: SizeSetting, callbackArgs?: A): [value: number, type?: 'px' | '%'] { if (typeof size === 'function') { - return parseSize(size(...callbackArgs)); + return parseSize(size(...(callbackArgs || []))); } if (typeof size === 'number') { return [size]; @@ -18,7 +18,7 @@ export function parseSize(size: SizeSetting, callbackArgs: unknown[] = []): [val return [NaN]; } -export function toCssSize(size: SizeSetting | undefined | null, callbackArgs?: unknown[]): string | null { +export function toCssSize(size: SizeSetting | undefined | null, callbackArgs?: A): string | null { if (size === undefined || size === null) { return null; }