Encountering typescript errors while building a project that incorporates angularfire2 and firebase. Here are the packages:
"angularfire2": "^2.0.0-beta.0",
"firebase": "^2.4.2",
Listed below are the errors:
[10:58:34] Finished 'build.html_css' after 4.51 s
[10:58:34] Starting 'build.js.dev'...
c:/Dev/daybreak/node_modules/angularfire2/database/database.d.ts(8,29): error TS2304: Cannot find name 'Firebase'.
c:/Dev/daybreak/node_modules/angularfire2/database/database.d.ts(9,31): error TS2304: Cannot find name 'Firebase'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth.d.ts(10,25): error TS2304: Cannot find name 'FirebaseCredentials'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth.d.ts(13,16): error TS2304: Cannot find name 'FirebaseAuthData'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth.d.ts(14,29): error TS2304: Cannot find name 'FirebaseCredentials'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth.d.ts(14,59): error TS2304: Cannot find name 'FirebaseAuthData'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth_backend.d.ts(4,44): error TS2304: Cannot find name 'FirebaseCredentials'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth_backend.d.ts(8,44): error TS2304: Cannot find name 'FirebaseAuthData'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth_backend.d.ts(9,25): error TS2304: Cannot find name 'FirebaseAuthData'.
c:/Dev/daybreak/node_modules/angularfire2/providers/auth_backend.d.ts(11,38): error TS2304: Cannot find name 'FirebaseCredentials'.
Inspecting database.d.ts in node_modules reveals no import for 'Firebase', causing the failure. The question arises - where should 'Firebase' be obtained from?
import { FirebaseListObservable } from '../utils/firebase_list_observable';
import { FirebaseObjectObservable } from '../utils/firebase_object_observable';
import { FirebaseListFactoryOpts } from '../utils/firebase_list_factory';
import { FirebaseObjectFactoryOpts } from '../utils/firebase_object_factory';
export declare class FirebaseDatabase {
private fbUrl;
constructor(fbUrl: string);
list(urlOrRef: string | Firebase, opts?: FirebaseListFactoryOpts): FirebaseListObservable<any[]>;
object(urlOrRef: string | Firebase, opts?: FirebaseObjectFactoryOpts): FirebaseObjectObservable<any>;
}
The query is why it's checking typings within node_modules since it's part of the exclude in tsconfig.json.
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"pretty": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true
},
"exclude": [
"node_modules",
"dist",
"typings/browser.d.ts",
"typings/browser",
"src"
],
"compileOnSave": false
}