Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert factory reexport #2014

Merged
merged 1 commit into from Sep 12, 2023

Conversation

shadowspawn
Copy link
Collaborator

@shadowspawn shadowspawn commented Sep 12, 2023

Pull Request

Problem

Adding reexports of the factory function in #2013 causes a TypeScript error from one of the optional checks:

% npm run typescript-checkJS

> commander@11.0.0 typescript-checkJS
> tsc --allowJS --checkJS index.js lib/*.js --noEmit

index.js:37:1 - error TS2303: Circular definition of import alias 'createCommand'.

37 exports.createCommand = program.createCommand;
   ~~~~~~~~~~~~~~~~~~~~~

index.js:38:1 - error TS2303: Circular definition of import alias 'createArgument'.

38 exports.createArgument = program.createArgument;
   ~~~~~~~~~~~~~~~~~~~~~~

index.js:39:1 - error TS2303: Circular definition of import alias 'createOption'.

39 exports.createOption = program.createOption;
   ~~~~~~~~~~~~~~~~~~~~


Found 3 errors in the same file, starting at: index.js:37

Solution

The failure the re-export was fixing is that the factory functions are not available with a whole-module import (import * as commander) when esModuleInterop: true.

A simple work-around if someone does encounter the problem is to use a named import for the factory function(s) they want.

So reverting the ex-export! (And the related tests can come back one day.)

Copy link
Collaborator

@abetomo abetomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

@shadowspawn shadowspawn merged commit 14edbca into tj:develop Sep 12, 2023
11 checks passed
@shadowspawn shadowspawn deleted the feature/revert-factory-reexport branch September 12, 2023 10:07
@shadowspawn shadowspawn added the pending release Merged into a branch for a future release, but not released yet label Sep 12, 2023
@shadowspawn shadowspawn removed the pending release Merged into a branch for a future release, but not released yet label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants