Closed phil-andrews closed 5 months ago
I vote for it as well.
Hi Radar Devs, any update on this? Providing a typings file should not be too hard. Please consider that issue :)
Hey, thanks for following up. We use TypeScript internally and understand how useful this would be. No timing yet, but on our roadmap.
i just created a pr with some type definitions but as i said in the pr #98 its a wip. if any one needs a quick copy pasta just create a .d.ts anywhere in your project, paste this and it should work.
declare module 'react-native-radar' {
export type permissionStatus = 'GRANTED' | 'DENIED' | 'UNKNOWN';
export type errorString =
| 'ERROR_PUBLISHABLE_KEY'
| 'ERROR_PERMISSIONS'
| 'ERROR_LOCATION'
| 'ERROR_NETWORK'
| 'ERROR_UNAUTHORIZED'
| 'ERROR_SERVER'
| 'ERROR_UNKNOWN';
export interface trackResult {
location: RadarLocation;
events: any;
user?: {
geofences: any;
};
}
export type onEvents = (
event: 'events',
callback: (result: { events: any; user: any }) => void,
) => void;
export type onLocation = (
event: 'location',
callback: (result: { location: RadarLocation; user: any }) => void,
) => void;
export type onError = (event: 'error', callback: (err: any) => void) => void;
export type onEvent = onEvents | onLocation | onError;
export interface RadarLocation {
latitude: number;
longitude: number;
accuracy: number;
}
export interface Radar {
initialize: (publishableKey: string) => void;
setUserId: (userId: string) => void;
setMetadata: (metadata: object) => void;
setDescription: (setDescription: string) => void;
setPlacesProvider: (provider: string) => void;
getPermissionsStatus: () => Promise<permissionStatus>;
// posible return permissionStatus but idk
requestPermissions: (background: boolean) => any;
trackOnce: () => Promise<trackResult>;
startTracking: (options: object) => any;
stopTracking: () => void;
on: onEvent;
off: (event: 'events' | 'location' | 'error') => void;
updateLocation: (location: RadarLocation) => trackResult;
}
const Radar: Radar;
export default Radar;
}
Are there any plans to release the updated types for v3?
UP ☝🏻 Are there any plans to release the updated types for v3?
Are there any updates on this?
Surely this can be closed now? I see typings in the latest version
@getinnocuous I saw you closed the #191 issue. Can you close this one too?
@getinnocuous I saw you closed the #191 issue. Can you close this one too?
I didn't raise it, @phil-andrews did
@getinnocuous I saw you closed the #191 issue. Can you close this one too?
I didn't raise it, @phil-andrews did
My bad, thought you might have have been a contributor and got my issues mixed up.
I imagine they've already been discussed so just count this as my vote for Typescript typings.