Angular TypeScript Error - APIServices does not exist on type Backendless

This is a continuation of a process previously discussed here: Angular and Backendless API Service

When trying to port the Backendless downloaded API Services javascript client SDK into a typescript file, Visual Studio Code seems to throw a false positive error of ‘error TS2339: Property ‘APIServices’ does not exist on type ‘typeof Backendless’.’. I label this as a false positive because when the server is kept running and the system is hot-reloaded to make use of the Backendless.APIServices.invoke function, pulling from custom service works fine (so it is assumed that this function must exist on the Backendless object). However, when starting the server fresh, the system will not compile properly because of the error.

Here is a sample of how its been worked into an Angular/TypeScript service

import { Injectable } from '@angular/core';
import Backendless from 'backendless';

const Utils = {
  isObject : obj => obj === Object(obj),
  isString : obj => Object.prototype.toString.call(obj).slice(8, -1) === 'String',
  isNumber : obj => Object.prototype.toString.call(obj).slice(8, -1) === 'Number',
  isBoolean: obj => Object.prototype.toString.call(obj).slice(8, -1) === 'Boolean',
  isDate   : obj => Object.prototype.toString.call(obj).slice(8, -1) === 'Date'
}

const testServiceName = {
  getEmpProjects(employee_id) {   
    if (!Utils.isNumber(employee_id)) {
      throw new Error('Invalid value for argument "employee_id". Must be number value')
    }
    
    const args = employee_id
    return Backendless.APIServices.invoke('testServiceName', 'getEmpProjects', args)
  }
}

@Injectable({
  providedIn: 'root'
})
export class UtimeServicesService {

  constructor() { }

  async getEmpProjects(employee_id): Promise<any> {
    return utimeServices.getEmpProjects(employee_id)
  }  
}

We figure there must be an accurate process to follow to get the Angular app working with the downloaded js file containing our services. Online, it seems there are a number of different solutions for generically importing an external javascript file for use in Angular involving altering the angular.json file, creating a typings.d.ts file, and importing but to no success.

Does there exist any documentation of how to properly use the downloaded SDK in Angular/other javascript frameworks? OR, would it be more effective (as a workaround) to call the service using an HTTP call to the endpoint, thus not needing the Backendless object at all. Surely we aren’t the only ones who have run into this use case.

Any info appreciated.

Hello @D_Williams

Thank you for the report, we can reproduce the problem and it is already fixed, we release the fix once our QA verify it

Regards, Vlad

the fix has been released in backendless@6.1.8

Thanks Vladimir.