-
Notifications
You must be signed in to change notification settings - Fork 717
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
feat: Support for export declarations #1157
Conversation
This partially adds support for export declarations under the same name. BREAKING CHANGE: Global files previously had all declarations marked as not-exported. This was inconsistent with TypeScript's concept of visibility. Now non-modules will have all members exported.
Incomplete: Theme updates
Tagging some people who've been involved recently in this for feedback: @PissedCapslock @nhynes @alalonde @ibezkrovnyi @gnidan |
I tested this out on Apache Arrow's JS implementation (we use export extensively) and encountered an error:
If you're interested it should be possible to repro with:
Or let me know if there's some additional debug info I can provide |
Thanks for the report! I should be able to give that a look later today. That error makes me think that one of TypeScript's "non nullable" properties is actually nullable. |
0.16.0-1 is out with a fix to the crash in Apache Arrow, the generated docs unfortunately look horrible... (And also... appear to be missing some items that are shown when generating with module mode...?) |
Sorry for the delay, but only now back at work. I tried the latest version on our project, but it looks like the exported members are still not present in the documentation. I created a repo to reproduce it:
The expected output is a Foo module with a If I change the
instead of
the class does appear in the documentation. As you'll see in the repo, the "special" thing we do is generate the documentation based on the output of the The current workaround I'm using is to set
|
Thanks @PissedCapslock! I must have gotten confused when looking through the specs, I could have sworn that was working already. Fixed in 0.16.0-2. |
Thanks Gerrit. Tested that new version on our real project and it looks like it solves the issue. Nice work. |
OK, just took a look and ran our (large!) codebase against it. The first thing I noticed is the set of warnings for erroneous exports. This is quite helpful. The second thing I noticed was that exporting object literals is still broken. Though I'm not sure that this PR intended to address that. #801 had addressed this though. We built and deployed our docs from a fork of #801 here: notice how this interface includes the nested type declarations, but when I generate docs against this PR those declarations are omitted. As for the multiple-export-link issue, I actually built a plugin on top of #801 that addresses that and adds some additional module organizational tags. I'll rebase that to work with this PR and see how it shakes out. |
Thanks @Gerrit0!
Personally I'm ok if we don't answer that question. I only set our up the Arrow docs to use file mode initially because it seemed to produce slightly more logical results for our crazy structure. With this change I think I will likely switch our build back to https://github.com/apache/arrow/blob/master/js/src/builder/int.ts#L56
Maybe it should actually be an error and there should be an "allowBrokenReferences" option to enable the behavior you have now? It seems likely that this is an indication something is wrong with your configuration. For the arrow build I'm actually not sure why these references are broken. I tried removing all the exclude* options and they are still broken. |
This should be fixed in 0.16.0-3 (just published), its technically unrelated to this PR, but the functionality is improved by it and we certainly don't want it to get lost.
This looks awesome!
I think this is the right option. File mode should be used iff you aren't actually using modules. With the library mode (almost the next thing on my todo list now!) I hope to make module mode obsolete.
I like this idea in principle but unfortunately it goes against how the rest of TypeDoc works. If we don't have docs for something we just list the name without a link, making a best effort no matter the input... (Maybe this philosophy should be changed, but it will require a fair bit of effort in other places around the code to make it consistent)
It's because of your |
Just tested |
You should have received a warning when generating the docs about a broken link. This is expected since you use |
Note to self - this breaks with TS 3.8 due to microsoft/TypeScript#34903 |
This corrects the change made in 9c3114d to use the type checker. Also reworks converter.test.ts to remove dead code + simplify adding new tests.
Just published what I hope is the last pre-release for this, I realized a fix I'd made early on was incorrect, fixed it again, found that it was broken with |
Are we TS 3.8 compatible again then ? I updated my plugin to use |
It shouldn't break with 3.8 now that I've looked a bit more into the API changes, but this won't catch namespace exports until it's updated to also handle Once 3.8 releases it should be a fairly simple change to support that :) |
I'm working on merging this in now, along with #936 and the fix/options branch that fixes a bunch of issues related to options. There will be (at least) one more pre-release once this is done because it changes a couple things.
There are still broken references in the Arrow docs because apparently we don't currently support |
After examining prior implementations (#646, #801, #1079, #1143), and spending a good bit of time trying to satisfy myself with #801, I decided to just try implementing a new type of declaration that references another declaration.
This is the result of that effort. The diff appears far larger than it really is since it includes updates to the tests (specifically, the rendering tests explode for any small change). I recommend looking at just the TS changes
Try it out:
This PR has been published as
typedoc@0.16.0-0
, which can be installed withnpm i typedoc@next
Comparisons:
I think the two biggest problems with this solution are that:
Screenshots
a
is re-exported usingexport * from './mod'
ExportedClassName
is exported usingexport { NotExportedClassName as ExportedClassName }