Since TypeScript and Durandal disagree about the semantics of require
("import this" vs "import a new instance of this"), you'll need to add a cast somewhere.
Option 1 -- cast at the consumption site:
import calendarServiceImport = require("service/CalendarService");
var calendarService = <ICalendarService><any>calendarServiceImport;
Option 2 -- cast at the export site:
import configuration = require('viewmodels/configure')
class CalendarService implements ICalendarService {
private NumberOfDaysToSync : number;
constructor() {
}
getCalendarNames(): string[] {
return ["My Calendar","My Other Calendar"];
}
pullLatestSchedule(calendarName : string) {
}
}
var instance = <ICalendarService><any>CalendarService;
export = instance;