diff --git a/index.js b/index.js index b865789be..bbba6e886 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,8 @@ const program = new Command(); exports = module.exports = program; // default export (deprecated) exports.program = program; // more explicit access to global command +// createArgument, createCommand, and createOption are implicitly available as they are methods on program. + /** * Expose classes */ @@ -26,14 +28,3 @@ exports.Help = Help; exports.CommanderError = CommanderError; exports.InvalidArgumentError = InvalidArgumentError; exports.InvalidOptionArgumentError = InvalidArgumentError; // Deprecated - -/** - * Expose object factory functions. - * - * These are present implicitly, but need to be explicit - * to work with TypeScript whole module import (import * as foo) when esModuleInterop: true. - */ - -exports.createCommand = program.createCommand; -exports.createArgument = program.createArgument; -exports.createOption = program.createOption; diff --git a/tests/ts-imports.test.ts b/tests/ts-imports.test.ts index 95611b1b6..82cfbc1af 100644 --- a/tests/ts-imports.test.ts +++ b/tests/ts-imports.test.ts @@ -102,15 +102,18 @@ describe('import * as commander', () => { checkClass(new commander.InvalidOptionArgumentError('failed'), 'InvalidArgumentError'); }); - test('createCommand', () => { - checkClass(commander.createCommand('foo'), 'Command'); - }); + // Factory functions are not found if esModuleInterop is true, so comment out tests for now. + // Can uncomment these again when we drop the default export of global program and add the factory functions explicitly. - test('createOption', () => { - checkClass(commander.createOption('-e, --example', 'description'), 'Option'); - }); + // test('createCommand', () => { + // checkClass(commander.createCommand('foo'), 'Command'); + // }); - test('createArgument', () => { - checkClass(commander.createArgument('', 'description'), 'Argument'); - }); + // test('createOption', () => { + // checkClass(commander.createOption('-e, --example', 'description'), 'Option'); + // }); + + // test('createArgument', () => { + // checkClass(commander.createArgument('', 'description'), 'Argument'); + // }); });