chore(components): improve type for popper effect (#17860)

* chore(components): improve type for popper effect

Abort #17758 #17751 #17040 #17030

* chore: use `NonNullable<unknown>` instead of `{}`

* chore(components): extract a common type for popper effect

---------

Co-authored-by: qiang <qw13131wang@gmail.com>
This commit is contained in:
wzc520pyfm
2024-12-05 09:44:47 +08:00
committed by GitHub
parent 8304d69118
commit 718ffcfb85
7 changed files with 9 additions and 7 deletions

View File

@@ -140,7 +140,7 @@ export const menuProps = buildProps({
* @description Tooltip theme, built-in theme: `dark` / `light` when menu is collapsed
*/
popperEffect: {
type: definePropType<PopperEffect | string>(String),
type: definePropType<PopperEffect>(String),
default: 'dark',
},
/**

View File

@@ -74,7 +74,7 @@ export const popperContentProps = buildProps({
type: definePropType<ClassType>([String, Array, Object]),
},
effect: {
type: definePropType<PopperEffect | string>(String),
type: definePropType<PopperEffect>(String),
default: 'dark',
},
visible: Boolean,

View File

@@ -24,7 +24,9 @@ export const roleTypes = [
'tree',
] as const
export type PopperEffect = typeof effects[number]
export type PopperEffect =
| typeof effects[number]
| (string & NonNullable<unknown>)
export type PopperTrigger = typeof triggers[number]
export const popperProps = buildProps({

View File

@@ -57,7 +57,7 @@ export const SelectProps = buildProps({
* @description tooltip theme, built-in theme: `dark` / `light`
*/
effect: {
type: definePropType<PopperEffect | string>(String),
type: definePropType<PopperEffect>(String),
default: 'light',
},
/**

View File

@@ -49,7 +49,7 @@ export const SelectProps = buildProps({
* @description tooltip theme, built-in theme: `dark` / `light`
*/
effect: {
type: definePropType<PopperEffect | string>(String),
type: definePropType<PopperEffect>(String),
default: 'light',
},
/**

View File

@@ -32,7 +32,7 @@ export const timeSelectProps = buildProps({
* @description Tooltip theme, built-in theme: `dark` / `light`
*/
effect: {
type: definePropType<PopperEffect | string>(String),
type: definePropType<PopperEffect>(String),
default: 'light',
},
/**

View File

@@ -28,7 +28,7 @@ export const tooltipV2ContentProps = buildProps({
default: 5,
},
effect: {
type: definePropType<PopperEffect | string>(String),
type: definePropType<PopperEffect>(String),
default: 'light',
},
contentClass: String,