microsoft / microsoft/TypeScript
When using a string value as export for reference, the .d.ts file created with dot notation instead of computed property which can break
Offen
@rbuckton arbeitet bereits daran.
Seit 10.2.2025.
Bug
Domain: Declaration Emit
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 132
Beschreibung
🔎 Search Terms
references, string exports
🕗 Version & Regression Information
- This changed between versions 5.6 and 5.7.3
This changed in commit or PR _______. It's a feature wasn't implemented fully- This is the behavior in every version I tried, and I reviewed the FAQ for entries about: Yes
- I was unable to test this on prior versions because: It's a new feature that isn't fully implemented (string exports)
⏯ Playground Link
💻 Code
// In a project with references that I forced to export a "private export". I export it as a string value which breaks .d.ts creation
interface ReferenceTo<T extends string> {
(value: T): T;
value: T;
}
// The `as "…"` part
export { ReferenceTo as "~ ReferenceTo" };
🙁 Actual behavior
I get the error
a/out/lib/y.d.ts:1:39 - error TS1110: Type expected.
1 export declare const x: import("./x").~ ReferenceTo<"x">;
~
a/out/lib/y.d.ts:1:39 - error TS1110: Type expected.
1 export declare const x: import("./x").~ ReferenceTo<"x">;
~
Found 2 errors.
According to @Andarist it somes to the issue as described in the playground
More in the Bluesky thread: https://bsky.app/profile/andarist.bsky.social/post/3lhrod2ysps2k
🙂 Expected behavior
It will export it as a computed value so it work
export declare const x: import("./x")["~ ReferenceTo"]<"x">;
Additional information about the issue
More in the Bluesky thread: https://bsky.app/profile/andarist.bsky.social/post/3lhrod2ysps2k
It seems it happens with Autocomplete as well.
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.