
[microsoft/TypeScript] `export { _void as void }` leads to exporting duplicate identifiers (Issue #62081)
DRANK
dmonad created an issue (microsoft/TypeScript#62081) ### 🔎 Search Terms export _void ### 🕗 Version & Regression Information - Reproducible since typescript v4. In older releases, it doesn't export anything. I also tried the latest dev release (5.9.0-dev.20250716) - This is the behavior in every version I tried, and I reviewed the FAQ for entries about `exports` ### ⏯ Playground Link _No response_ ### 💻 Code I can't produce this in the playground. However, it is very easy to reproduce using the command line utility `tsc` and the latest typescript release. Using the following `tsconfig.json`: ```json { "compilerOptions": { "target": "esnext", "lib": ["esnext"], "module": "esnext", "allowJs": true, "checkJs": true, "declaration": true, "declarationMap": true, "outDir": "./dist", "emitDeclarationOnly": true, "strict": true, "noImplicitAny": true, "moduleResolution": "bundler" } } ``` I compile declaration files for this code `${project}/schema.js`: ```ts const _null = {} const $void = {} export { _null as null, $void as void } ``` ### 🙁 Actual behavior The produced declaration file `schema.d.ts` is erroneous. It has duplicate identifiers: ```ts declare const _null: {}; declare const $void: {}; export { _null as null, _null as null, $void as void, _void as void }; ``` ### 🙂 Expected behavior No duplicate identifiers: ```ts declare const _null: {}; declare const $void: {}; export { _null as null, $void as void }; ``` ### Additional information about the issue For any reserved keyword, typescript always exports `_{reserved} as {reserved}`, whenever `{reserved}` is exported. Even though the variable `_{reserved}` does not exist. This is not reproducible in the playground, only when using `tsc`. -- Reply to this email directly or view it on GitHub: https://github.com/microsoft/TypeScript/issues/62081 You are receiving this because you are subscribed to this thread. Message ID: <microsoft/TypeScript/issues/62081@github.com>
👀 github.com/microsoft/Type…