Wrapper for navigator.geolocation.getCurrentPosition with ensure rejected the promise when timeout
yarn add get-location-with-timeout
import getCurrentLocationWithTimeout, { TimeoutError } from 'get-location-with-timeout'
try {
const { coords } = await getCurrentLocationWithTimeout()
// logic
} catch (error) {
if (error instanceof TimeoutError) {
// handle timeout logic
} else {
// handle other reject logic
}
}