Skip to content

Commit 3304ff9

Browse files
enhance: clean attributes types
1 parent 86f541b commit 3304ff9

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

addons/van_jsx/src/jsx-internal.d.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@ import { State, ChildDom } from "vanjs-core";
33
import { FunctionChild } from "./type";
44

55
type OriginalElement = HTMLElement;
6+
type JSXProp<T, K extends keyof T> = T[K] | (() => T[K]) | State<T[K]>;
67

78
export declare namespace JSX {
8-
type JSXProp<T, K extends keyof T> = K extends "children"
9-
? ChildDom
10-
: K extends "style"
11-
? CSS.Properties
12-
: K extends "ref"
13-
? State<T>
14-
: T[K] | (() => T[K]) | State<T[K]>;
159
type HTMLAttributes<T> = {
16-
[K in keyof T]?: JSXProp<T, K>;
17-
};
10+
[K in keyof Omit<T, "children" | "style">]?: JSXProp<T, K>;
11+
} & Partial<{ children: ChildDom; style: CSS.Properties; ref: State<T> }>;
12+
1813
type SVGAttributes<T> = {
19-
[K in keyof T]?: JSXProp<T, K>;
20-
};
14+
[K in keyof Omit<T, "children" | "style">]?: JSXProp<T, K>;
15+
} & Partial<{ children: ChildDom; style: CSS.Properties; ref: State<T> }>;
16+
2117
export type ElementType = string | FunctionChild<any>;
2218
export interface Element extends OriginalElement {}
2319
export interface ElementAttributesProperty {

0 commit comments

Comments
 (0)