microsoft / microsoft/TypeScript
Invalid synthesized import specifiers on infered types in declarations
Offen
@weswigham arbeitet bereits daran.
Seit 30.10.2023.
Needs Investigation
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔎 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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.