I am trying to use BreezeJS with the standard Typescript type definition files. Using the test file as a guide, I have the following:
/// <reference path="../typings/breeze/breeze.d.ts" />
import breeze = module(Breeze);
class ExerciseEntityManager {
manager: breeze.EntityManager;
constructor() {
this.manager = new breeze.EntityManager({
serviceName: 'api/ExerciseItems'
});
}
GetAllExercises(success: any, fail?: any) {
var query = Breeze.EntityQuery.from('ExerciseItems');
// TODO: Make sure this works if fail is undefined
return this.manager.executeQuery(query)
.then(success)
.fail(fail);
}
}
This compiles to the following:
var breeze = Breeze;
var ExerciseEntityManager = (function () {
function ExerciseEntityManager() {
this.manager = new breeze.EntityManager({
serviceName: 'api/ExerciseItems'
});
}
ExerciseEntityManager.prototype.GetAllExercises = function (success, fail) {
var query = Breeze.EntityQuery.from('ExerciseItems');
return this.manager.executeQuery(query).then(success).fail(fail);
};
return ExerciseEntityManager;
})();
When I load this into my page, I get the javascript error: 'Uncaught reference error: Breeze is not defined.' I get a similar error using the breeze-tests.ts file from the breeze repository, so I am obviously doing something wrong.
If I comment out the 'var breeze = Breeze;' line from the compiled file, it works, but this is obviously not an ideal solution.
Can anyone help?