Skip to content

How to force inclusion of non-exported variables? #1474

@tomchen

Description

@tomchen

[Solved] Please use the typedoc-plugin-not-exported plugin to solve the problem described here.

npm i -D typedoc-plugin-not-exported

Search Terms

force include non exported unexported variable option flag tag mode file exclude

Problem

I can't find any way (either a @ tag in comment or an option / flag) to generate docs for variables that are not exported

Consider

(I don't export the type)

type twoNumbers = [number, number]
export function sum(ns: twoNumbers) {
  return ns[0] + ns[1]
}

or

(I only export the type used directly by the parameter)

type twoNumbers = [number, number]
type threeNumbers = [number, number, number]
export type twoOrThreeNumbers = twoNumbers | threeNumbers;
export function sum2(ns: twoOrThreeNumbers): number {
  return ns.reduce((a, b) => a + b)
}

or even

(I only export the instance of the class but not the class. Because user may use me.method(), I may want to include the methods of the class in my documentation)

class ClassName {
  ...
  method() { ... }
}
export const me = new ClassName()

It seems there used to be a mode: 'file' option, which has been removed in the latest version of typedoc, this option can enable inclusion of everything, including the non exported variables. (but I'm not asking for this option to be re-added, I just want a includeNonExported or similar option)

Suggested Solution

Something like a @includeindoc tag to force inclusion of a specific variable (preferably)
(I don't think @public can be used here, they are not public but I just want them to be included in the doc)

and/or

A global option / flag, that could be named includeNonExported or something, and allows to include all non exported variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    plugin ideaThis feature may be best suited for a pluginwontfixDeclining to implement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions