Browse Source

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

fix #12832
webfansplz 3 năm trước cách đây
mục cha
commit
0b3cf7dda9
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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 = {