TypeScript: Can't find name error when accessing interface across multiple files
I am trying to create some definition files for a personal project. (I am recreating the context here with different class / module names, so the modeling might not make much sense).
I have the following interface definition file that has no dependencies and compiles fine:
// File: automobile.d.ts
declare module Transport {
interface Automobile {
// ... variables and functions
accelerate(direction:String):Boolean;
}
}
However, in this file, when I try to reference Automobile
in this file in the same module Transport
, I get Cannot find name 'Automobile'
.
// File: automobile_collection.d.ts
declare module Transport {
interface AutomobileCollection {
size:Number;
getItemAt(index:Number): Automobile;
}
}
I tried to export the interface, but it didn't help. Any ideas what I am doing wrong?
+3
source to share
1 answer