typescript-go
typescript-go copied to clipboard
Inferred import type in declaration file uses actual path not use rootdirs path
Steps to reproduce
Repo: https://github.com/dragomirtitian/ts-go-root-dirs-not-in-declaration-files
// @fileName: /data/some-code.ts
import { UpdateBundleConfigResponse } from "./types"
const config = null! as UpdateBundleConfigResponse;
export const exportedConfig = config;
// @fileName: /data/types.ts
import { SuccessResponse } from "../gen-types";
export type UpdateBundleConfigResponse = SuccessResponse;
// @fileName: /non-js/gen-types.ts
export type SuccessResponse = {
text?: string;
};
// @fileName: /tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"declaration": true,
"declarationDir": "./out/project",
"outDir": "./out/project",
"rootDirs": [
"",
"non-js"
],
},
"exclude": [
"./out"
]
}
Behavior with [email protected]
Inferred import type for exported variable uses rootdir path
export declare const exportedConfig: import("../gen-types").SuccessResponse;
Behavior with tsgo
Inferred import type uses actual path:
export declare const exportedConfig: import("../non-js/gen-types").SuccessResponse;