Open
Description
π Search Terms
"import specifiers in declarations", "import nested files"
π Version & Regression Information
Can reproduce on version 5.2.2 and "next" (5.3.0-dev.20231030).
β― Playground Link
No response
π» Code
// @file a.ts
import { forwardRef, type PropsWithChildren } from "react";
import { type ExportedType } from "@ts-bug/b";
export type Props = PropsWithChildren<{
// Tile props.
active?: ExportedType;
}>;
export const Component = forwardRef<HTMLLIElement, Props>(() => {
return null;
});
// @file @ts-bug/src/index.ts
import { type ExportedType as NaturalExportedType } from './type'
export type ExportedType = NaturalExportedType;
// @file @ts-bug/src/type.ts
export type ExportedType = 'overlay' | 'rearrange' | 'origin' | 'destination';
π Actual behavior
The generated declarations for a.ts
contain an invalid import into one of the nested declaration files instead of using the main package export.
// @file a.d.ts
import { type PropsWithChildren } from "react";
import { type ExportedType } from "@ts-bug/b";
export type Props = PropsWithChildren<{
active?: ExportedType;
}>;
export declare const Component: import("react").ForwardRefExoticComponent<{
active?: import("b/dist/types/src/type").ExportedType | undefined;
} & {
children?: import("react").ReactNode;
} & import("react").RefAttributes<HTMLLIElement>>;
//# sourceMappingURL=index.d.ts.map
π Expected behavior
The declarations should use the main package export.
active?: import("@ts-bug/b").ExportedType | undefined;
Additional information about the issue
Repoduction repo:
https://github.com/dmaretskyi/ts-bug