I want to use external javascript library (MyLib) without typings in my XClient.ts file so I created a dump declaration file for external lib, (myLib.d.ts) When I import myLib to XClient, everything is ok in XClient constructor but typescript compiler throw error at "readonly _lib: MyLib;" line of XClient.ts
Compiler error: " error TS2304: Cannot find name 'MyLib'
How can I use external library without typings properly? And why compiler throw error?
// XClient.ts
import * as $ from "jquery";
import * as MyLib from "myLib";
export class XClient {
readonly _modelId: string;
readonly _lib: MyLib;
constructor(modelId: string) {
this._modelId = modelId;
this._lib = new MyLib(this._modelId);
}
}
// myLib.d.ts
declare var inner: any;
declare module "myLib" {
export = inner;
}