mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-12 17:45:49 +08:00
This CL introduces a new `GenericEvents` type that can be used in cases where the set of events is not known at compile time. An example are settings, where the setting name is used as the event name. With `GenericEvents` in place, we can greatly reduce the type magic required to make type-safe event listeners work for all cases. More specifically the event name is now a simple `keyof Events` and the payload for a specific event `Foo` is `Events[Foo]`. This CL is the final step for type-safe event listeners. R=pfaffe@chromium.org Fixed: 1228674 Change-Id: I095c6bd388d55848bde2776f88beec6d89a618c2 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3175290 Reviewed-by: Philip Pfaffe <pfaffe@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org>