Skip to content

Commit

Permalink
fix: types for useGeolocation
Browse files Browse the repository at this point in the history
  • Loading branch information
WesSouza committed Mar 26, 2019
1 parent 12bc932 commit b72c098
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/useGeolocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import {useState, useEffect} from 'react';

export interface GeoLocationSensorState {
loading: boolean,
accuracy: number,
altitude: number,
altitudeAccuracy: number,
heading: number,
latitude: number,
longitude: number,
speed: number,
timestamp: number,
accuracy: number | null,
altitude: number | null,
altitudeAccuracy: number | null,
heading: number | null,
latitude: number | null,
longitude: number | null,
speed: number | null,
timestamp: number | null,
error?: Error | PositionError
}

const useGeolocation = () => {
const [state, setState] = useState({
const useGeolocation = (): GeoLocationSensorState => {
const [state, setState] = useState<GeoLocationSensorState>({
loading: true,
accuracy: null,
altitude: null,
Expand Down Expand Up @@ -43,7 +43,7 @@ const useGeolocation = () => {
});
}
};
const onEventError = (error: any) =>
const onEventError = (error: PositionError) =>
mounted && setState(oldState => ({...oldState, loading: false, error}));

useEffect(() => {
Expand Down

0 comments on commit b72c098

Please sign in to comment.