π Search Terms
commonjs, exports, function
π Version & Regression Information
β― Playground Link
Thanks for merging I'm still seeing an odd behavior I think is related: here's the minimal repro I could find - bug workbench link
π» Code
// @showEmittedFile: main.ts
// @module: commonjs
// @filename: main.ts
import { Foo } from "./file-with-export"
export function createFoo(): Foo {
return {};
}
export {createFoo as createFooV2};
// @filename: file-with-export.ts
export interface Foo {}
π Actual behavior
main.js has two exports for createFoo and createFooV2:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFoo = createFoo;
exports.createFooV2 = createFoo;
exports.createFoo = createFoo;
exports.createFooV2 = createFoo;
function createFoo() {
return {};
}
π Expected behavior
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFoo = createFoo;
exports.createFooV2 = createFoo;
function createFoo() {
return {};
}
Additional information about the issue
I believe this is a result of the fix for #58473. (I still appreciate having these duplicate exports rather than the compiler dropping the exports entirely π )
In the debugger, I see that this exportedFunctions (
|
exportedFunctions: Set<FunctionDeclaration>; // all of the top-level exported function declarations |
) set contains two separate
createFoo nodes.
If I remove the export {createFoo as createFooV2} from the repro, or remove the declared return type : Foo, I get the expected behavior.
This was uncovered by testing the latest TS version in Google (#58685)
π Search Terms
commonjs, exports, function
π Version & Regression Information
β― Playground Link
Thanks for merging I'm still seeing an odd behavior I think is related: here's the minimal repro I could find - bug workbench link
π» Code
π Actual behavior
main.js has two exports for
createFooandcreateFooV2:π Expected behavior
Additional information about the issue
I believe this is a result of the fix for #58473. (I still appreciate having these duplicate exports rather than the compiler dropping the exports entirely π )
In the debugger, I see that this
exportedFunctions(TypeScript/src/compiler/transformers/utilities.ts
Line 108 in 506f3e2
createFoonodes.If I remove the
export {createFoo as createFooV2}from the repro, or remove the declared return type: Foo, I get the expected behavior.This was uncovered by testing the latest TS version in Google (#58685)