Closed
Description
When generating a .d.ts file, typescript is including a relative reference for an import, which is imported as a module.
import { a } from "@ts-bug/a";
export function b(text: string) {
return a(text);
}
generated a definition file:
/// <reference path="../../a/index.d.ts" />
export declare function b(text: string): import("@ts-bug/a").AText;
In this case it is in a mono-repo which may be confusing things, but the reference should be the same as the import.
TypeScript Version:
3.0.3, but also happens with 3.1.0-dev.20180901
Search Terms:
relative reference paths
generated reference relative
Code
I have created a repo with a simple reproduction here https://github.com/wgcrouch/ts-bug
Expected behavior:
The reference /// <reference types="@ts-bug/a" />
Actual behavior:
The reference generated is /// <reference path="../../a/index.d.ts" />
Related Issues:
#26439