Property 'data' does not exist on type 'ArrayBuffer'


#1

Hello, I have this really weird problem with Ionic. On every new build/serve/lab, the following error occurs:

typescript: src/providers/city/city.ts, line: 17 
            Property 'data' does not exist on type 'ArrayBuffer'.

Here is the problematic file:

import { Injectable } from '@angular/core';
import {JApiProvider} from "../j-api/j-api";
import {CityModel} from "../../models/city.model";
import "rxjs-compat/add/operator/map";

@Injectable()
export class CityProvider {

  constructor(private api: JApiProvider) {
  }

  search( name: string ) {
    console.log( response.data );
    return this.api.get( 'city', { name: name } ).map(
      response => {
        return response.data.map(
          cityData => {
            return new CityModel(
              cityData.id,
              cityData.name,
              cityData.province,
              cityData!.lat,
              cityData!.lng
            );
          }
        );
      }
    );
  }
}

The strange thing is that if I edit the file(let’s say just add a console.log(), or remove), hit “save” (so it can recompile), the problem disappears. So when the problem occurs, I make a small change, save, and then it works. Do you have any idea what the problem can be?

Here info about my setup:

cli packages: (/usr/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v9.2.0
    npm  : 5.5.1 
    OS   : Linux 4.10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Here is my package.json file:

{
  "name": "JApp",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/animations": "5.2.9",
    "@angular/common": "5.2.9",
    "@angular/compiler": "5.2.9",
    "@angular/compiler-cli": "5.2.9",
    "@angular/core": "5.2.9",
    "@angular/forms": "5.2.9",
    "@angular/http": "5.2.9",
    "@angular/platform-browser": "5.2.9",
    "@angular/platform-browser-dynamic": "5.2.9",
    "@auth0/angular-jwt": "^2.0.0",
    "@ionic-native/camera": "^4.7.0",
    "@ionic-native/core": "^4.7.0",
    "@ionic-native/file": "^4.7.0",
    "@ionic-native/file-transfer": "^4.7.0",
    "@ionic-native/google-maps": "^4.8.2",
    "@ionic-native/native-storage": "^4.7.0",
    "@ionic-native/splash-screen": "4.6.0",
    "@ionic-native/status-bar": "4.6.0",
    "@ionic-native/wheel-selector": "^4.7.0",
    "@ionic/storage": "2.1.3",
    "angular-jwt": "^0.1.9",
    "cordova-android": "7.0.0",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-googlemaps": "^2.3.6",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^1.2.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-sqlite-storage": "^2.3.1",
    "cordova-wheel-selector-plugin": "^1.1.1",
    "flag-icon-css": "^3.0.0",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "minimist": "^1.2.0",
    "ng2-rx-componentdestroyed": "^3.0.0",
    "rxjs": "^6.1.0",
    "rxjs-compat": "^6.1.0",
    "sw-toolbox": "3.6.0",
    "xml2js": "^0.4.19",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.8",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-sqlite-storage": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-camera": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-transfer": {},
      "cordova-wheel-selector-plugin": {},
      "cordova-plugin-googlemaps": {
        "API_KEY_FOR_ANDROID": "removed",
        "API_KEY_FOR_IOS": "removed",
        "PLAY_SERVICES_VERSION": "15.0.1",
        "ANDROID_SUPPORT_V4_VERSION": "26.1.0"
      }
    },
    "platforms": [
      "android"
    ]
  }
}

#2

response: any should be declared for the app to start working…