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

Better support for code using "export=" #1422

Closed
Gerrit0 opened this issue Dec 26, 2020 · 2 comments
Closed

Better support for code using "export=" #1422

Gerrit0 opened this issue Dec 26, 2020 · 2 comments
Labels
enhancement Improved functionality

Comments

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Dec 26, 2020

Search Terms

module.exports, export assignment, export=

Problem

In 0.20, TypeDoc relies on the type checker to get exports - this works fine for the majority of TypeScript projects, but has resulted in worse support for legacy common JS projects that do bad things like this:

export = function () {} // 1
export = { a, b, c, } // 2
export = 1 // 3
type Z = 1
export = Z // 4
function a() {}
namespace a {}
export = a // 5

Suggested Solution

This is somewhat tricky to solve - # 2 above can be handled nicely by just "lifting" the "export=" symbol's properties so that they are documented under the parent module, but this breaks other cases.

# 1 and # 5 can probably be handled by setting the "signatures" property on the module...

But # 3 and # 4 are an extra level of horrible. The first should really be documented as a variable and the second as a type... I want to believe that people wouldn't do this, but...

@Gerrit0
Copy link
Collaborator Author

Gerrit0 commented Jan 23, 2021

This gets worse! In JS, export= doesn't mean that other stuff can't be exported. #1476.... if you're using this. Please do your users a favor and give them a named export.

/** @typedef {string} Str */
/** */
module.exports = function() {}

@Gerrit0
Copy link
Collaborator Author

Gerrit0 commented Jun 26, 2022

I expected a lot more interest in this - but am quite happy it's seen effectively no activity, since actually implementing this would make TypeDoc's already complicated "getExports" function much worse. I'm going to close this as not planned.

@Gerrit0 Gerrit0 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improved functionality
Projects
None yet
Development

No branches or pull requests

1 participant