Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

ngc Error: Property 'string' does not exist on type... #122

Closed
barbsicle opened this issue Oct 8, 2016 · 3 comments
Closed

ngc Error: Property 'string' does not exist on type... #122

barbsicle opened this issue Oct 8, 2016 · 3 comments

Comments

@barbsicle
Copy link

Short description of the problem:

My app works fine when using ionic serve. However, when I run a build (e.g. ionic run android), ngc will throw an error:

[21:56:25]  ngc: Error: Error at D:/Users/User/Desktop/project/.tmp/app/app.module.ngfactory.ts:587:140: Property 'string' does not exist on type 'typeof "D:/Users/User/Desktop/project/.tmp/providers/firebase.service"'.
  at check (D:\Users\User\Desktop\project\node_modules\@angular\tsc-wrapped\src\tsc.js:31:15)
  at Tsc.typeCheck (D:\Users\User\Desktop\project\node_modules\@angular\tsc-wrapped\src\tsc.js:86:9)
  at D:\Users\User\User\project\node_modules\@angular\tsc-wrapped\src\main.js:33:23
  at process._tickCallback (internal/process/next_tick.js:103:7)
  at Module.runMain (module.js:592:11)
  at run (bootstrap_node.js:394:7)
  at startup (bootstrap_node.js:149:9)
  at bootstrap_node.js:509:3

The constructor code in question is below:

Injectable()
export class FirebaseService extends AngularFire {
...
    constructor(firebaseConfig: string, auth: AngularFireAuth, database: AngularFireDatabase) {
        super(firebaseConfig, auth, database)
    }
...
}

Some people on the forum have worked around this by removing all mention of string in the constructor, but because I am extending from the AngularFire class, I must state the super call as is.

What behavior are you expecting?

ngc should not throw an error(?)

Steps to reproduce:

  1. Create a class with a string variable in the constructor.
  2. Include said class in app.module.ts
  3. Run $ npm run build or $ ionic run android or $ ionic run ios

Which @ionic/app-scripts version are you using?
0.0.30

@Vanclief
Copy link

Vanclief commented Oct 8, 2016

Had same problem, feel this is related that on ionic.modules when the provider is declared, there is no string. My solution was to make the class abstract, remove it from [providers] app.modules.ts and just make that every other class using it is extending it.


export abstract class FirebaseService extends AngularFire {

}

@jgw96
Copy link
Contributor

jgw96 commented Oct 14, 2016

Hello, sorry for the delay on this one! This is actually an NGC error and not an Ionic error. NGC is the AoT compiler that the Angular team is building. It has the ability to do typechecking of variables and methods that are bound to your templates, it is also very strict in its typechecking. Since NGC is an Angular project i am going to close this issue and ask that you open an issue on the Angular repo. Thanks!

@jgw96 jgw96 closed this as completed Oct 14, 2016
@marcoturi
Copy link
Contributor

If anyone is getting this error, [this issue] (angular/angular#12551) could be of same help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants