Navigation Menu

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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for TS entry points in monorepo configuration #1596

Merged
merged 6 commits into from Jun 13, 2021
Merged

Add support for TS entry points in monorepo configuration #1596

merged 6 commits into from Jun 13, 2021

Conversation

Unnvaldr
Copy link
Contributor

@Unnvaldr Unnvaldr commented Jun 9, 2021

Firstly, thank you @efokschaner and @Gerrit0 for implementing packages entry points 馃槂

I've added it as we talked about it in #1567, for now TS files must have extension set explicitly, otherwise they won't be "fetched".

If it's fine as-is, it would be nice to get it released in beta channel ASAP.

@efokschaner
Copy link
Contributor

Thanks for contributing!

@Unnvaldr
Copy link
Contributor Author

CONTINUATION OF DISCUSSION

Should we first allow the default value of index.js to be tested for existence before we resort to the types field?
I could imagine a package which had an index.ts, an index.js, and index.d.ts, and therefore doesn't specify package.main,

With this change typedoc would now parse index.d.ts for docs rather than index.ts, while it's probably preferable to parse index.ts.

On the other hand, usually when main & types are specified, it means that dev has specified a separate file created for storing his types definitions (case when your project is written in JS, but you've added TS types only to not rewrite whole project in TS), so logically we should check out types/typings first. Previously we had includeDeclarations flag for controlling whenever you wanted to include .d.ts files in documenting process, but AFAIK it's gone since v0.20 (which would be helpful to disable/enable behaviour described above).

@efokschaner
Copy link
Contributor

When main is specified (or the default works) we use the source mapping in the js to find the original ts. If we can't find the .ts I agree with checking for types (the .d.ts).
We should prefer finding the .ts though as it's more likely to contain the kind of tsdoc markup + other annotations that power typedoc, not to mention creating links to the .ts rather than the .d.ts in typedoc output.

So, in short, I agree with using the .d.ts when there is no .ts, as long as we try to find that .ts first.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Jun 13, 2021

This seems reasonable to me, thanks!

@Gerrit0 Gerrit0 merged commit 6d215df into TypeStrong:beta Jun 13, 2021
@Unnvaldr Unnvaldr deleted the feat/monorepos branch June 14, 2021 18:27
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

3 participants