Checklist
Code Snipped
// index.d.ts
declare namespace a {
var fn: typeof import("./other-file.d.ts").fn;
}
export { a };
// other-file.d.ts
export declare function fn(): void;
The .ts files are
// index.ts
import { fn } from "./other-file";
export function a() {}
a.fn = fn;
// other-file.ts
export function fn() {}
Output
declare function fn(): void;
declare function a(): void;
declare namespace a {
var fn: typeof fn;
}
export { a };
You can see that var fn circularly references itself, rather than referencing the fn function.
Checklist
Other plugins, such as
node-resolveare known to cause issues..d.tsfiles generated by TypeScript.The plugin can consume
.tsand even.jsfiles (withallowJs: true), but this is known to cause issues.@types.The plugin ignores these by default, unless
respectExternalis set.@typescan contain hand-crafted code which is known to cause issues.Code Snipped
The
.tsfiles areOutput
You can see that
var fncircularly references itself, rather than referencing thefnfunction.