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

Non-exported referenced types #2411

Closed
Azario16 opened this issue Oct 9, 2023 · 2 comments
Closed

Non-exported referenced types #2411

Azario16 opened this issue Oct 9, 2023 · 2 comments
Labels
question Question about functionality

Comments

@Azario16
Copy link

Azario16 commented Oct 9, 2023

          @Gerrit0 Good afternoon

I agree with you that there is no point in describing variables that are not exported

But what about the interfaces that are exported and inside which there are parameters from the same directory and they are not exported but are used inside the exported interface

How will a person who opens the documentation understand what exactly needs to be put in the required parameter?

Example:

export interface User {
    detail: Detail
}

interface Detail {
    name: string;
    age: number
}

image

Originally posted by @Azario16 in #1521 (comment)

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Oct 15, 2023

Detail should be exported. By not exporting it, you're making your API distinctly worse by requiring that if I'm building up an object for your API iteratively I either have to extract the type myself:

const det: User["detail"] = { ... }

const user: User = { detail: det }

Or live without excess property checks while building that object up.

const det = {
  name: "x",
  age: 123,
  married: false
}

const x: User = { detail: det } // NO errors!

However, I've gotten sufficiently tired of arguing with people about this, so typedoc-plugin-missing-exports exists, and will automatically create documentation for non-exported "exports" and stick them in an <internals> namespace.

@Gerrit0 Gerrit0 added the question Question about functionality label Oct 15, 2023
@Gerrit0 Gerrit0 changed the title @Gerrit0 Good afternoon Non-exported referenced types Oct 15, 2023
@Azario16
Copy link
Author

Yes, you're right, it's really logical and makes sense.
Thanks for the answer and experience

@Gerrit0 Gerrit0 closed this as completed Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about functionality
Projects
None yet
Development

No branches or pull requests

2 participants