Currently, I am facing an issue with a third-party library that provides global functions similar to jQuery ($ .functionName()), but unfortunately there is no definition file available. Due to this, my attempt to write my own file has been unsuccessful as the reference/import mechanism does not seem to be functioning properly.
Surprisingly, if I include my declarations directly in the code, it works perfectly:
declare let a: string;
myClass {
constructor() {
console.log(a);
}
}
However, when I try to declare it in a separate file, things don't work out as expected:
myDeclaration.d.ts
export declare let a: string;
myClass.ts
/// <reference path="myDeclaration.d.ts" />
myClass {
constructor() {
console.log(a);
}
}
I even attempted to use
import * as a from "myDeclaration"
, but unfortunately it keeps throwing the error: Cannot find name 'a'