Skip to content

Commit

Permalink
Optimizing ref types
Browse files Browse the repository at this point in the history
  • Loading branch information
yinxulai committed Jun 3, 2024
1 parent 70cfb6b commit a134e2b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions source/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ export interface VideoHTMLAttributes extends MediaHTMLAttributes {
width?: Numberish
disablePictureInPicture?: Booleanish
}

export interface WebViewHTMLAttributes extends HTMLAttributes {
allowfullscreen?: Booleanish
allowpopups?: Booleanish
Expand All @@ -718,6 +719,7 @@ export interface WebViewHTMLAttributes extends HTMLAttributes {
useragent?: string
webpreferences?: string
}

export interface SVGAttributes extends AriaAttributes, EventHandlers<Events> {
innerHTML?: string
/**
Expand Down Expand Up @@ -977,7 +979,8 @@ export interface SVGAttributes extends AriaAttributes, EventHandlers<Events> {
z?: Numberish
zoomAndPan?: string
}
interface IntrinsicElementAttributes {

interface IntrinsicElementAttributesMap {
a: AnchorHTMLAttributes
abbr: HTMLAttributes
address: HTMLAttributes
Expand Down Expand Up @@ -1152,17 +1155,16 @@ interface IntrinsicElementAttributes {
view: SVGAttributes
}

export type HtmlRef<T extends HTMLElement = HTMLElement> = {
ref?: Signal.State<T | undefined>
}

export type ReservedProps = {
children?: AirxChildren
key?: string | number | symbol
ref?: Signal.State<unknown | undefined>
}

export type NativeElements = {
[K in keyof IntrinsicElementAttributes]: IntrinsicElementAttributes[K] & ReservedProps & HtmlRef
[K in keyof IntrinsicElementAttributesMap]:
IntrinsicElementAttributesMap[K]
& ReservedProps
}

declare global {
Expand Down

0 comments on commit a134e2b

Please sign in to comment.