diff --git a/react-native-reanimated.d.ts b/react-native-reanimated.d.ts index 506a2a73949..831f85e2787 100644 --- a/react-native-reanimated.d.ts +++ b/react-native-reanimated.d.ts @@ -251,9 +251,12 @@ declare module 'react-native-reanimated' { export function clockRunning(clock: AnimatedClock): AnimatedNode<0 | 1>; // the return type for `event` is a lie, but it's the same lie that // react-native makes within Animated - export function event( - argMapping: ReadonlyArray, - config?: {}, + type EventArgFunc = (arg: T) => Node; + type EventMapping = T extends object ? { [K in keyof T]?: EventMapping | EventArgFunc } : Adaptable | EventArgFunc; + type EventMappingArray = T extends Array ? { [I in keyof T]: EventMapping } : [EventMapping] + export function event( + argMapping: T extends never ? ReadonlyArray : Readonly>, + config?: {}, ): (...args: any[]) => void; // derived operations