I can't get Promise working when using TypeScript.
My code is:
import geolocation from 'geolocation';
export function getCurrentLocation(): Promise<any> {
return new Promise<any>((resolve: any, reject: any) => {
geolocation.getCurrentPosition((position: any) => {
resolve(position.coords);
}, (error: any) => {
reject(error);
});
});
}When building I get the error:
/companion/util.ts (4,14): TS2693: 'Promise' only refers to a type, but is being used as a value here.
Answered! Go to the Best Answer.
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
TypeScript is not officially supported by Fitbit Studio yet, but as a temporary solution:
declare const Promise: any;
I took this from your own message on Discord 🙂
Best Answer
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.