Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6213

React Native extend NativeModules TypeScript types

$
0
0

I have a native module and I would like to type it.

Here is an example of my module's interface

export interface BBAudioPlayer {  playSound: (sound: 'click' | 'tada') => Promise<void>;  pause: () => Promise<void>;}

and that is how I use it:

NativeModules.BBAudioPlayer.playSound('tada');

How can extend NativeModules to add the types of my new module?


Viewing all articles
Browse latest Browse all 6213

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>