pmndrs / react-three-fiber

🇨🇭 A React renderer for Three.js
https://docs.pmnd.rs/react-three-fiber
MIT License
27.62k stars 1.6k forks source link

fix: ThreeEvent should not include initMouseEvent #3372

Closed bbohlender closed 1 month ago

bbohlender commented 1 month ago

Currently, the types for all onClick, ... events expose the initMouseEvent function. The Properties type definition has the goal to remove all functions, but it only removes functions with one parameter. Therefore the initMouseEvent is not removed and the type is forwarded to the event, even though no initMouseEvent function exists on the actual event object.

This PR fixes that and uses a more modern way of filtering entries in the map using as supported from typescript 4.1 (4 years ago). https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#key-remapping-via-as

codesandbox-ci[bot] commented 1 month ago

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c67877157d3a6ca8e1e016b57b11adfde1325d4a:

Sandbox Source
example Configuration
CodyJasonBennett commented 1 month ago

Nice find.