Kaynağa Gözat

fix(types): stricter type condition for `EventHandlers` (#12840)

fix #12832
webfansplz 3 yıl önce
ebeveyn
işleme
0b3cf7dda9
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      types/jsx.d.ts

+ 3 - 1
types/jsx.d.ts

@@ -1297,7 +1297,9 @@ export interface Events {
 }
 
 type EventHandlers<E> = {
-  [K in keyof E]?: E[K] extends Function ? E[K] : (payload: E[K]) => void
+  [K in keyof E]?: E[K] extends (...args: any) => any
+    ? E[K]
+    : (payload: E[K]) => void
 }
 
 type ReservedProps = {