[SOLVED] Error: Property "" does not exist on type ""

Hi,

I am following this tutorial to setup ionic app: https://angular-meteor.com/tutorials/whatsapp2/ionic/setup

and at the end of bootstrapping I keep getting the errors mentioned below:
I’ve tried installing ionic, cordova and these plugins multiple times but to no use.


Code:

import { Component } from ‘@angular/core’;
import { Platform } from ‘ionic-angular’;
import { StatusBar } from ‘@ionic-native/status-bar’;
import { SplashScreen } from ‘@ionic-native/splash-screen’;

import { TabsPage } from ‘…/pages/tabs/tabs’;

@Component({
templateUrl: ‘app.html’
})
export class MyApp {
rootPage:any = TabsPage;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
if (platform.is(‘cordova’)) {
StatusBar.styleDefault();
SplashScreen.hide();
}
});
}
}


Errors:

[22:33:05] build started …
[22:33:05] transpile update started …
[22:33:05] transpile update finished in 42 ms
[22:33:05] deeplinks update started …
[22:33:05] deeplinks update finished in 22 ms
[22:33:06] typescript: src/app/app.component.ts, line: 19
Property ‘styleDefault’ does not exist on type ‘typeof StatusBar’.

  L18:  if (platform.is('cordova')) {
  L19:    StatusBar.styleDefault();
  L20:    SplashScreen.hide();

[22:33:06] typescript: src/app/app.component.ts, line: 20

        Property 'hide' does not exist on type 'typeof SplashScreen'. 

  L19:    StatusBar.styleDefault();
  L20:    SplashScreen.hide();

[22:33:06] build finished in 1.45 s

Change StatusBar to statusBar (you put it in your constructor) and SplashScreen into splashScreen (as in your constructor).

2 Likes

BTW if you set the post that answered your question to solved, it will automatically the solved checkmark :wink:

1 Like

Not “solved”. Solution =
Typescript Error
Cannot find name ‘statusBar’.
C:/smenu/src/app/app.component.ts
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
});
Ionic Framework: 3.4.0
Ionic App Scripts: 1.3.7
Angular Core: 4.1.3
Angular Compiler CLI: 4.1.3
Node: 6.10.2
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36

Please open up a new thread for this, because this post was already solved. If it isn’t for you, open up a new post. Please post your exact error message and format your code with < /> in the editor or by manually wrapping it in ` backticks.