type Platform = 'web' | 'react-native' ; export const getPlatform = ( ) : Platform => { let platform = 'web' ; if ( typeof document !== 'undefined' ) { platform = 'web' ; } else if ( typeof navigator !== 'undefined' && navigator . product === 'ReactNative' ) { platform = 'react-native' ; } else { platform = 'web' ; } return platform ; } ; export const platform = getPlatform ( ) ;