I have a module that depends on Backbone
. I have a backbone.d.ts
definition but TypeScript doesn't seem to want to compile my module unless my
import Backbone = module("backbone")
actually points to a valid backbone module as opposed to a definition file. I am using AMD loaded modules and have a requirejs shim defined for backbone.
Is there a workaround besides creating a phoney backbone.ts module definition?
Update: A side effect of the solution is that code such as this no longer works because the module no longer exists. It needs to exist because of the requirejs shim. The only workaround I know of is to have two .d.ts files. One for the file using backbone as an import that does not include the declare module
bit. The other for using a /// <reference
that does include the declare module
line.
/// <reference path="../dep/backbone/backbone.d.ts" />
interface IApi {
version: number;
Events: Backbone.Events;
}