I have developed typescript library which consists of several classes located in separate ts files.
app.ts
//imported class from separate file
import leafAdd = require('./Base/leaf');
export class MyClass {
public leafInstance : leafAdd.Leaf;
}
var MyClassInstance = new MyClass();
The code works fine so i want to use my library in a new separate project, still I do not want to transfer whole code. Instead I just want to use definition files from typescript compiler (generated by adding --declarations flag). The declaration files look like this:
app.d.ts
import leafAdd = require('./Base/leaf');
export declare class MyClass {
public leafInstance : leafAdd.Leaf;
}
When I try to reference this file in a new project it somehow does not work:
newapp.ts
/// <reference path="./typings/app.d.ts" />
export class MyOtherClass{
public myClass: MyClass; //Compiler error: Could not find symbol MyClass
constructor() {
//some other code
}
}
And I got compiler error saying: "Could not find symbol MyClass"
Perhaps I am missing something obvious or just trying to reference the code in a wrong way. I would be really gratefull if someone can point me to the right direction.