Skip to content

Commit 7a1f406

Browse files
Fix Position type
1 parent 5578b54 commit 7a1f406

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

src/location-provider/LocationProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useInterval } from '../index'
44
import { getCurrentLocation } from './getCurrentLocation'
55

66
export type LocationContextValue = {
7-
location: Position | null
7+
location: GeolocationPosition | null
88
}
99

1010
export const LocationContext = createContext<LocationContextValue>({

src/location-provider/getCurrentLocation.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
const getCurrentLocation = (highAccuracy = false): Promise<Position> => {
2-
return new Promise<Position>((resolve, reject) => {
3-
const successCallback = (position: Position): void => {
1+
const getCurrentLocation = (
2+
highAccuracy = false
3+
): Promise<GeolocationPosition> => {
4+
return new Promise<GeolocationPosition>((resolve, reject) => {
5+
const successCallback = (position: GeolocationPosition): void => {
46
resolve(position)
57
}
68

7-
const errorCallback = (error: PositionError) => {
9+
const errorCallback = (error: GeolocationPositionError) => {
810
reject(error.message)
911
}
1012

0 commit comments

Comments
 (0)