-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue
Milestone
Description
Bug Report
The output of transpileModule did not preserve the value exports from the input module when the identifier also matches a type. This does not happen when compiling the project using tsc or with verbatimModuleSyntax enabled.
🔎 Search Terms
- transpileModule
- exports
- preserve
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about module emit.
⏯ Playground Link
Playground link with relevant code
Interestingly the error that is appearing in the playground
Import declaration conflicts with local declaration of 'Component'.(2440)
Is not appearing for the same code in VSCode for a repo version of the issue: https://github.com/acutmore/transpile-module-bug
💻 Code
// exports.ts
import fooValue from "./values";
import type {Foo} from "./types";
const Foo: Foo = fooValue as any as Foo;
export {Foo};import tsc from "typescript";
import * as fs from "node:fs";
const result = tsc.transpileModule(fs.readFileSync("./exports.ts", "utf-8"), {
compilerOptions: {
"verbatimModuleSyntax": false,
"importsNotUsedAsValues": "error",
"ignoreDeprecations": "5.0",
"module": "ESNext"
}
});🙁 Actual behavior
import fooValue from "./values";
var Foo = fooValue;🙂 Expected behavior
import fooValue from "./values";
var Foo = fooValue;
export { Foo };mkubilayk, tchetwin and robpalme
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issue