Skip to content

Commit

Permalink
feat(types/ide): support find definition for jsx tags, events (#3570)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk authored Jul 1, 2021
1 parent 81e69b2 commit 8ed3ed6
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/runtime-dom/types/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1296,10 +1296,8 @@ export interface Events {
onTransitionstart: TransitionEvent
}

type StringKeyOf<T> = Extract<keyof T, string>

type EventHandlers<E> = {
[K in StringKeyOf<E>]?: E[K] extends Function ? E[K] : (payload: E[K]) => void
[K in keyof E]?: E[K] extends Function ? E[K] : (payload: E[K]) => void
}

// use namespace import to avoid collision with generated types which use
Expand All @@ -1317,7 +1315,7 @@ type ReservedProps = {
type ElementAttrs<T> = T & ReservedProps

type NativeElements = {
[K in StringKeyOf<IntrinsicElementAttributes>]: ElementAttrs<
[K in keyof IntrinsicElementAttributes]: ElementAttrs<
IntrinsicElementAttributes[K]
>
}
Expand Down

0 comments on commit 8ed3ed6

Please sign in to comment.