Skip to content

Commit e17b1ba

Browse files
committed
feat: 增加 Props<P, E> 泛型,支持传入 Element 具体类型
1 parent 243c5d1 commit e17b1ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ export * from './const.js';
44

55
// eslint-disable-next-line @typescript-eslint/no-explicit-any
66
type AnyObject = Record<keyof any, any>;
7-
export type Props<P extends AnyObject = AnyObject> = {
7+
export type Props<P extends AnyObject = AnyObject, E extends HTMLElement = HTMLElement> = {
88
className?: ClassName;
99
style?: CSSProperties & Record<string, string>;
1010
children?: ReactNode;
11-
} & HTMLAttributes<HTMLElement> &
11+
} & HTMLAttributes<E> &
1212
P;
1313
export type RuntimeProps<P extends AnyObject, D extends Partial<P>> = Omit<P, keyof D> & Required<Pick<P, keyof D>>;
1414

0 commit comments

Comments
 (0)