zmxv / react-native-sound

React Native module for playing sound clips
MIT License
2.78k stars 749 forks source link

Fix type definitions to allow chaining #642

Closed dsernst closed 2 years ago

dsernst commented 4 years ago

Most of the .setYY() methods return this to support chaining. E.g.:

And the readme describes this behavior:

  • You may chain non-getter calls, for example, sound.setVolume(.5).setPan(.5).play().

But the current type definitions say most of these functions return void, which causes TypeScript to yell at you if you try to chain.

image

This PR updates the type definitions to fix this, and properly reflect that these functions are returning this.