Reason why If I change common.d.ts ionic serve runs properly

Hi there!

I have a doubt and I hope anyone can help me.

When I execute ionic serve, I have this error:

[app-scripts] [15:04:28] transpile started …
[app-scripts] [15:04:42] typescript: /app/node_modules/@ionic-native/core/decorators/common.d.ts, line: 10
[app-scripts] Cannot find name ‘unknown’.
[app-scripts] L9: export declare function wrapPromise(pluginObj: any, methodName: string, args: any, opts?: CordovaOptions): Promise;
[app-scripts] L11: * Checks if plugin/cordova is available

I have read that if I change unknown for any at line 10 of common.d.ts at @ionic-native/core/decorators, the error disappears. It’s true, but I want to know the reason.

My dependencies at package.json are:

“dependencies”: {
@angular/animations”: “^5.2.11”,
@angular/common”: “^5.2.11”,
@angular/compiler”: “^5.2.11”,
@angular/compiler-cli”: “^5.2.11”,
@angular/core”: “^5.2.11”,
@angular/forms”: “^5.2.11”,
@angular/http”: “^5.2.11”,
@angular/platform-browser”: “^5.2.11”,
@angular/platform-browser-dynamic”: “^5.2.11”,
@angular/router”: “^5.2.11”,
@auth0/angular-jwt”: “^1.2.0”,
@ionic-native/app-version”: “5.14.0”,
@ionic-native/core”: “5.14.0”,
@ionic-native/date-picker”: “5.14.0”,
@ionic-native/file”: “^5.14.0”,
@ionic-native/file-opener”: “^5.14.0”,
@ionic-native/globalization”: “5.14.0”,
@ionic-native/in-app-browser”: “5.14.0”,
@ionic-native/ionic-webview”: “5.14.0”,
@ionic-native/splash-screen”: “5.14.0”,
@ionic-native/status-bar”: “5.14.0”,
@ionic/storage”: “2.2.0”,
@ngx-translate/core”: “^9.1.1”,
@ngx-translate/http-loader”: “^2.0.1”,
@types/lodash”: “4.14.118”,
“cordova”: “^9.0.0”,
“cordova-android”: “8.1.0”,
“cordova-browser”: “6.0.0”,
“cordova-ios”: “5.0.1”,
“cordova-plugin-app-version”: “^0.1.9”,
“cordova-plugin-datepicker”: “^0.9.3”,
“cordova-plugin-device”: “^2.0.3”,
“cordova-plugin-file”: “^6.0.2”,
“cordova-plugin-file-opener2”: “^2.2.1”,
“cordova-plugin-globalization”: “^1.11.0”,
“cordova-plugin-inappbrowser”: “^3.1.0”,
“cordova-plugin-ionic-keyboard”: “^2.2.0”,
“cordova-plugin-ionic-webview”: “^4.1.2”,
“cordova-plugin-splashscreen”: “^5.0.3”,
“cordova-plugin-statusbar”: “git+https://github.com/apache/cordova-plugin-statusbar.git”,
“cordova-plugin-whitelist”: “^1.3.4”,
“ionic-angular”: “^3.9.8”,
“ionic-tooltips”: “^2.1.1”,
“ionic2-super-tabs”: “^4.3.1”,
“ionicons”: “^3.0.0”,
“jwt-decode”: “^2.2.0”,
“lodash”: “4.17.11”,
“moment”: “^2.24.0”,
“ngx-permissions”: “^4.1.0”,
“node-sass”: “^4.11.0”,
“run”: “1.4.0”,
“rxjs”: “^5.5.12”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.26”
},
“devDependencies”: {
@ionic/app-scripts”: “^3.2.2”,
@ionic/lab”: “1.0.6”,
“typescript”: “2.8.3”
}

Thanks in advanced.

My suspicion (based only on instinct) is that ionic-native 5 is not playing nice with such an old Angular. So if at all possible, I would try updating your Angular to 8. If that’s not doable, might need to downgrade ionic-native to 4.x.

Thank you so much for your response.

I tried to update angular version and I have more errors:

Error

[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 214
[app-scripts] Initializers are not allowed in ambient contexts.
[app-scripts] L213: * Configures the root injector for an app with
[app-scripts] L214: * providers of @angular/core dependencies that ApplicationRef needs
[app-scripts] L215: * to bootstrap components.
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 4961
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 9668
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 10339
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 11604
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 12120
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 12351
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 12351
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/core/core.d.ts, line: 13688
[app-scripts] [08:26:09] typescript: …/app/node_modules/@angular/platform-browser-dynamic/src/compiler_factory.d.ts, line: 18
[app-scripts] Initializers are not allowed in ambient contexts.
[app-scripts] L4960: readonly last: T;
-scripts] L4961: constructor();
[app-scripts] A ‘const’ initializer in an ambient context must be a string or numeric literal.
[app-scripts] L9667: * can be present, null or undefined. If undefined then it implies the value has not been
[app-scripts] L9668: * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.
[app-scripts] A ‘const’ initializer in an ambient context must be a string or numeric literal.
[app-scripts] L10339: export declare const ɵSWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__: typeof injectViewContainerRef;
[app-scripts] Cannot find name ‘unknown’.
[app-scripts] L11604: * Construct an InjectorDef which configures an injector.
[app-scripts] Cannot find name ‘unknown’.
[app-scripts] L12120: * In a case of no explicit injector, a location where the instance of the injectable is stored.
[app-scripts] JSDoc types can only be used inside documentation comments.
[app-scripts] L12350: export declare type ɵɵPipeDefWithMeta<T, Name extends string> = ɵPipeDef;
[app-scripts] JSDoc ‘…’ may only appear in the last parameter of a signature.
[app-scripts] L12350: export declare type ɵɵPipeDefWithMeta<T, Name extends string> = ɵPipeDef;
[app-scripts] Cannot find name ‘unknown’.
[app-scripts] L13687: * @param index Index of the node in the data array
ripts] L13688: * @param value Value to write. This value will be stringified.
[app-scripts] Class ‘CompilerImpl’ incorrectly implements class ‘Compiler’. Did you mean to extend ‘Compiler’ and inherit
[app-scripts] its members as a subclass? Property ‘getModuleId’ is missing in type ‘CompilerImpl’.
[app-scripts] L17: compileModuleSync(moduleType: Type): NgModuleFactory;
[app-scripts] L18: compileModuleAsync(moduleType: Type): Promise<NgModuleFactory>;
[app-scripts] L19: compileModuleAndAllComponentsSync(moduleType: Type): ModuleWithComponentFactories;
[app-scripts] Cannot find name ‘unknown’.
[app-scripts] L9: export declare function wrapPromise(pluginObj: any, methodName: string, args: any, opts?: CordovaOptions): Promise;
[app-scripts] L11: * Checks if plugin/cordova is available
[app-scripts] Expected 2 arguments, but got 1.
[app-scripts] L34: @ViewChild(Content) pageContent: Content;
[app-scripts] Expected 2 arguments, but got 1.
[app-scripts] L17: @ViewChild(Content) private pageContent: Content;
[app-scripts] Expected 2 arguments, but got 1.
[app-scripts] Argument of type ‘{ read: typeof ElementRef; }’ is not assignable to parameter of type ‘{ read?: any;
[app-scripts] static: boolean; }’. Property ‘static’ is missing in type ‘{ read: typeof ElementRef; }’.
[app-scripts] L31: @ViewChild(Header, { read: ElementRef }) header: ElementRef;
[app-scripts] L32: @ViewChild(Content, { read: ElementRef }) content: ElementRef;
[app-scripts] Argument of type ‘{ read: typeof ElementRef; }’ is not assignable to parameter of type ‘{ read?: any;
[app-scripts] static: boolean; }’. Property ‘static’ is missing in type ‘{ read: typeof ElementRef; }’.
[app-scripts] L31: @ViewChild(Header, { read: ElementRef }) header: ElementRef;
[app-scripts] L32: @ViewChild(Content, { read: ElementRef }) content: ElementRef;
[app-scripts] Expected 2 arguments, but got 1.
[app-scripts] L34: @ViewChild(‘myT’)
[app-scripts] L35: private superTabs: Tabs;
[app-scripts] Expected 2 arguments, but got 1.
[app-scripts] L28: @ViewChild(Content) content: Content;
[app-scripts] L29: @ViewChild(InfiniteScroll) infinite: InfiniteScroll;
[app-scripts] Expected 2 arguments, but got 1.
[app-scripts] L28: @ViewChild(Content) content: Content;
[app-scripts] L29: @ViewChild(InfiniteScroll) infinite: InfiniteScroll;
[app-scripts] L30: @ViewChild(‘head’) head: ElementRef;
[app-scripts] Expected 2 arguments, but got 1.
[app-scripts] L29: @ViewChild(InfiniteScroll) infinite: InfiniteScroll;
[app-scripts] [08:26:09] typescript: …/app/node_modules/@ionic-native/core/decorators/common.d.ts, line: 10

My new dependencies are:

Dependencies

“dependencies”: {
@angular/animations”: “^5.2.11”,
@angular/common”: “^5.2.11”,
@angular/compiler”: “^5.2.11”,
@angular/compiler-cli”: “^5.2.11”,
@angular/core”: “^8.2.9”,
@angular/forms”: “^5.2.11”,
@angular/http”: “^5.2.11”,
@angular/platform-browser”: “^5.2.11”,
@angular/platform-browser-dynamic”: “^5.2.11”,
@angular/router”: “^5.2.11”,
@auth0/angular-jwt”: “^1.2.0”,
@ionic-native/app-version”: “5.14.0”,
@ionic-native/core”: “5.14.0”,
@ionic-native/date-picker”: “5.14.0”,
@ionic-native/file”: “^5.14.0”,
@ionic-native/file-opener”: “^5.14.0”,
@ionic-native/globalization”: “5.14.0”,
@ionic-native/in-app-browser”: “5.14.0”,
@ionic-native/ionic-webview”: “5.14.0”,
@ionic-native/splash-screen”: “5.14.0”,
@ionic-native/status-bar”: “5.14.0”,
@ionic/storage”: “2.2.0”,
@ngx-translate/core”: “^9.1.1”,
@ngx-translate/http-loader”: “^2.0.1”,
@types/lodash”: “4.14.118”,
“cordova”: “^9.0.0”,
“cordova-android”: “8.1.0”,
“cordova-browser”: “6.0.0”,
“cordova-ios”: “5.0.1”,
“cordova-plugin-app-version”: “^0.1.9”,
“cordova-plugin-datepicker”: “^0.9.3”,
“cordova-plugin-device”: “^2.0.3”,
“cordova-plugin-file”: “^6.0.2”,
“cordova-plugin-file-opener2”: “^2.2.1”,
“cordova-plugin-globalization”: “^1.11.0”,
“cordova-plugin-inappbrowser”: “^3.1.0”,
“cordova-plugin-ionic-keyboard”: “^2.2.0”,
“cordova-plugin-ionic-webview”: “^4.1.2”,
“cordova-plugin-splashscreen”: “^5.0.3”,
“cordova-plugin-statusbar”: “git+https://github.com/apache/cordova-plugin-statusbar.git”,
“cordova-plugin-whitelist”: “^1.3.4”,
“ionic-angular”: “^3.9.8”,
“ionic-tooltips”: “^2.1.1”,
“ionic2-super-tabs”: “^4.3.1”,
“ionicons”: “^3.0.0”,
“jwt-decode”: “^2.2.0”,
“lodash”: “~4.17.15”,
“moment”: “^2.24.0”,
“ngx-permissions”: “^4.1.0”,
“node-sass”: “^4.11.0”,
“run”: “1.4.0”,
“rxjs”: “^5.5.12”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.26”
},
“devDependencies”: {
@ionic/app-scripts”: “^3.2.4”,
@ionic/lab”: “1.0.6”,
“typescript”: “2.8.3”
}

I am updating ionic-native to the newest version because the plugin of date-picker doesn’t show calendar or clock in devices with iOS 13. This issue may be due to dark mode or dependencies. I don’t know yet.

Any new idea?

More stuff is going to have to come up to recent versions, and I fear from the presence of “ionic2-super-tabs” that this may not be easy. “ionic-angular” needs to be replaced by “@ionic/angular”, typescript is going to have to come up some, all the @angular/* stuff needs to join @angular/core. It may be easier to generate a new project and parachute your existing code into it.

Finally, I discover that the problem with date-picker plugin is dark mode for iOS13. So I force light mode when my app is used. So it not a problem of dependencies so I think I can go back to an estable state.

Your answers are so helpful, thank you so much.