Skip to content

module.exports = [] fails with AssertionError [ERR_ASSERTION]: false == true #2909

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

Closed
jacobshirley opened this issue Mar 19, 2025 · 2 comments

Comments

@jacobshirley
Copy link

Search terms

AssertionError [ERR_ASSERTION]: false == true
at Object.convertType (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/types.js:128:9)
at convertType (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/types.js:112:34)
at Converter.convertType (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/converter.js:336:20)
at Object.convertVariable (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/symbols.js:584:45)
at _convertSymbolNow (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/symbols.js:113:41)
at convertSymbol (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/symbols.js:126:5)
at Converter.convertSymbol (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/converter.js:333:13)
at Converter.convertExports (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/converter.js:444:22)
at Converter.compile (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/converter.js:405:22)
at Converter.convert (file:///folder/node_modules/.pnpm/typedoc@0.28.0_typescript@5.7.3/node_modules/typedoc/dist/lib/converter/converter.js:310:18) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}

Expected Behavior

It should be able to process module.exports = []; as it is valid JavaScript/TypeScript.

Actual Behavior

It throws the above error.

Steps to reproduce the bug

Run typedoc on the following code:

module.exports = []

Environment

  • Typedoc version: 0.28.0
  • TypeScript version: 5.7.3
  • Node.js version: v20.9.0
  • OS: Linux
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 19, 2025

I really wish people wouldn't do this type of thing with CommonJS... that ESM prevents it is my favorite thing about that module system.

@jacobshirley
Copy link
Author

I really wish people wouldn't do this type of thing with CommonJS... that ESM prevents it is my favorite thing about that module system.

I agree, we have a lot of legacy code like this. Thanks for the quick fix!

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

No branches or pull requests

2 participants