Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 00:54
    Gerrit0 commented #1853
  • 00:53
    Gerrit0 closed #1135
  • 00:51
    Gerrit0 commented #1856
  • Jan 28 22:09
    bennycode commented #1857
  • Jan 27 17:34
    futurGH synchronize #1794
  • Jan 27 14:31
    Dayday10 commented #1856
  • Jan 27 14:00
    Gerrit0 edited #1760
  • Jan 27 03:22
    Gerrit0 commented #1856
  • Jan 27 03:07
    Gerrit0 pinned #1857
  • Jan 27 03:07
    Gerrit0 assigned #1857
  • Jan 27 03:07
    Gerrit0 labeled #1857
  • Jan 27 03:07
    Gerrit0 opened #1857
  • Jan 26 16:03
    Dayday10 commented #1856
  • Jan 26 15:59
    Dayday10 commented #1856
  • Jan 26 15:50
    Dayday10 commented #1856
  • Jan 26 13:51
    alexberdichevsky commented #1856
  • Jan 26 13:32
    Gerrit0 commented #1856
  • Jan 26 12:48
    alexberdichevsky labeled #1856
  • Jan 26 12:48
    alexberdichevsky opened #1856
  • Jan 25 21:47
    sebsonjura commented #1045
Krisztián Balla
@krisztianb
The array type is defined like this:
/**
 * A type describing what should be replaced by what as it is defined by the user in the config.
 */
type ReplaceInfoFromConfig = {
    /** The regular expression pattern used to find the text that should be replaced. */
    pattern: string;

    /** Flags for the regular expression pattern. */
    flags?: string;

    /** The text that should be used as a replacement. */
    replace: string;
};
Gerrit Birkeland
@Gerrit0
That definitely seems like a bug...
Oh, wait, maybe not... typedoc doesn't really support arrays which aren't strings as options so its probaby going into some branch that typedoc never sees...
I would still expect that to work, or maybe be unknown, not... whatever that is
Krisztián Balla
@krisztianb

Changing the TypeDocOptionValues type from:

export declare type TypeDocOptionValues = {
    [K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends string | string[] | number | boolean | Record<string, boolean> ? TypeDocOptionMap[K] : TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
};

to this:

export declare type TypeDocOptionValues = {
    [K in keyof TypeDocOptionMap]: unknown extends TypeDocOptionMap[K] ? unknown : TypeDocOptionMap[K] extends string | number | boolean | Record<string, boolean> | Array<unknown> ? TypeDocOptionMap[K] : TypeDocOptionMap[K][keyof TypeDocOptionMap[K]];
};

fixes the problem. Otherwise it gets into the last case of this conditional type whose last case I don't understand. What is TypeDocOptionMap[K][keyof TypeDocOptionMap[K]] supposed to mean?

Gerrit Birkeland
@Gerrit0
TypeDocOptionMap[K][keyof TypeDocOptionMap[K]] is for handling mapped options, EntryPointStrategy is an example
It gives "resolve" | "expand" | "packages" rather than the keys of the object
Krisztián Balla
@krisztianb
Does replacing string[] with Array<unknown> make sense?
Gerrit Birkeland
@Gerrit0
Not really, typedoc doesn't have any non-string array arguments... I'm not opposed to reworking the source interface to better handle unrecognized types though
Caleb Taylor
@aquaductape
How do you use default value for documentation? Like this?
type Foo = {
  /**
   * @defaultvalue boolean
   * 
   * Some Description about the prop
   */
  cursorKeys?: boolean | {random: string};
}
Krisztián Balla
@krisztianb
Have you tried @default instead of @defaultvalue?
Caleb Taylor
@aquaductape
I think @defaultValue is future proof solution based on what others advised me https://tsdoc.org/pages/tags/defaultvalue/
Also I needed to be @defaultValue last, instead of before description, otherwise the intellisense won't render it correctly in vscode.
type Foo = {
  /**
   *
   * Some Description about the prop
   *
   * @defaultValue `boolean`
   */
  cursorKeys?: boolean | {random: string};
}
Oren Griffin
@orengriffin

trying to achieve something pretty basic. maybe someone can help, this is my code:


/** Description of MyType interface */
interface MyType {
  /** This property is ... */
  haha: number;
  /** Optional property useful for ... */
  optional?: string;
}

/**
 * Description of what MyClass is
 */
class MyClass {
  /**
   * @param config Docs on config property.It is different than the interface docs
   */
  constructor(config: MyType) {}
}
export default MyClass;

and i get this error:
"Warning: MyType, defined at src/index.ts:43, is referenced by default.constructor.new default.config but not included in the documentation."
how can i include MyType in the documnation?

Krisztián Balla
@krisztianb
Only things that are exported through your defined entryPoints are included in the documentation. If you don't want to export MyType, you might take a look at this plugin: https://github.com/Gerrit0/typedoc-plugin-missing-exports
Oren Griffin
@orengriffin
thanks, exactly what i needed
David First
@davidfirst
Hi,
I'm trying to use TypeDoc programmatically. I followed the instructions here: https://typedoc.org/guides/installation/ and it worked well.
Can I get the types data programmatically as well? In the guide, the last step calls app.generateDocs which writes the data to the filesystem, but I want the object in-memory. How can I do that?
jankojjs
@jankojjs
Hello all, I have a typescript react app I need to make documentation for. I used this command in the CLI: npx typedoc --tsconfig ./tsconfig.json --out ./docs --entryPointStrategy expand ./src
But it exports all components, etc as modules
Is there a command option so that it reads it as react app?
Krisztián Balla
@krisztianb
@jankojjs there is a plugin for merging the modules into the project: https://www.npmjs.com/package/typedoc-plugin-merge-modules
@davidfirst what are you trying to achieve? You could write a plugin that listens for an event that is emitted when the docs are generated.
jankojjs
@jankojjs
@krisztianb hello and thank you for the answer should i still use the same command to generate the docs?
jankojjs
@jankojjs
WOW! @krisztianb you are the man! Thank you so much sir
Krisztián Balla
@krisztianb
@jankojjs yes, the default config should do what you are looking for.
jankojjs
@jankojjs
Was having a struggle with that one for the last 2-3 days, thank you. That absolutely fixed it.
David First
@davidfirst
@krisztianb , the thing is that I don't want any docs to be generated. I simply need the data before it got generated to the filesystem.
My use case is a bit complex, but think about a workspace with multiple web components, when each component has metadata, such as, main-file, dependency-graph, tests-results and so on. Among the metadata I want to store the "exports", or in other words, the API this component exposes. The metadata eventually gets saved compressed in a format similar to Git objects.
Krisztián Balla
@krisztianb
@davidfirst did you look at the options? There is something like a JSON output and an emit option to turn off the docs generation completely.
David First
@davidfirst

Thanks @krisztianb , it helps to avoid emitting the files, which is great! now, how do I get the JSON results? this method generateJson returns void:

generateJson(project: ProjectReflection, out: string): Promise<void>;

Must be an API method that returns the same JSON as the output.

Krisztián Balla
@krisztianb
Do you need the JSON files or the reflection objects? I'm not sure what the best way for this is.
David First
@davidfirst
I need the JSON files content.
I can generate the JSON files by running generateJson, and then read them from the filesystem.
But I want to avoid this extra two steps and get it directly from the API.
Krisztián Balla
@krisztianb
How would you access the API? I was thinking about a plugin that can access the reflection data and use it for whatever is desired.
David First
@davidfirst
I didn't link to the exact place. It's here: https://typedoc.org/guides/installation/#node-module
I just followed this guide to work with TypeDoc programatically. I don't believe that a plugin is required here, I'm pretty sure it's possible to get from the API.
Krisztián Balla
@krisztianb
Sorry, I have no experience with that. Didn't even know that was possible. Cool thing.
jankojjs
@jankojjs
One more thing I am experiencing is:
I am working an ts reactjs app, and using typedoc-plugin-export-modules typedoc-plugin-rename-defaults and
when generating docs for class components I am not getting functions exported even if they have comments, only componentDidMount(), componentDidUpdate() but not custom functions
Krisztián Balla
@krisztianb
I think you should open an Issue about that on Github. It's really hard to figure it out just by knowing these things.
Preferably with a link to a repo where one can take a closer look.
Gerrit Birkeland
@Gerrit0
@davidfirst I'd recommend just using the project if you're working with the API, it's essentially the JSON with some helper methods.
However, you can get the in memory JSON with the same code that the Application does - https://github.com/TypeStrong/typedoc/blob/master/src/lib/application.ts#L420-L432
And yes - please do open issues with questions. I don't remember to check Gitter often
BambiMC
@BambiMC

Hey,
could some explain how exactly the "internal/external"-button works?
Gerrit0 mentioned that "Symbols (not files) are now[version>=0.20] marked external based solely on externalPattern, and TypeDoc defaults to marking symbols as external if they come from node_modules."
In my case, even the file i include in entrypoints and tsconfig: files[] is considered external.
if i set "externalPattern":[""] (i override the default value which is "**/node_modules/**"), everything is internal now.
The file i specifically want to be internal is "cypress/support/index.d.ts" (it's a cypress project)
index.d.ts:

`declare namespace Cypress {
interface Chainable {

/**
 * Returns the average of two numbers.(just an example)
 *
 * @example
 * dataCy(6, 9);
 * @param value1 - The first input number
 * @param value2 - The second input number
 * @returns The arithmetic mean of `value1` and `value2`
 */
computeAvg(value1: number, value2: number): Chainable<any>;

//...
}}`

Has anyone an idea what i am doing wrong?
btw: for some reason the search function is broken for me, i cant search for anything. Enter won't work.
Thanks in advance! ^^

Syed Muhammad Akbar
@SMAkbar

Hello,
I am try to just run the typedoc to generate atleast some kind of documentation.
I am getting the following errors:

Error: node_modules/near-sdk-core/assembly/contract.ts:159:3 - error TS2564: Property 'id' has no initializer and is not definitely assigned in the constructor.

159   id: u64;
      ~~

Error: node_modules/near-sdk-core/assembly/promise.ts:52:3 - error TS2564: Property 'id' has no initializer and is not definitely assigned in the constructor.

52   id: u64;
     ~~

Error: node_modules/near-sdk-core/assembly/util.ts:112:26 - error TS2304: Cannot find name '__new'.

112     return changetype<T>(__new(offsetof<T>(), idof<T>()));

I am using the following options
"typedocOptions": { "entryPoints": [ "as/NFT/assembly/index.ts" ], "out": "docs" }, "exclude": [ "node_modules", ],

Lastly, I am triggering the typedoc with this command:
npx typedoc --out "docs"

Krisztián Balla
@krisztianb
@SMAkbar those are compiler errors. Typedoc compiles your code and uses the reflections returned by the TypeScript compiler to build the docs. So those errors are in your code and you should probably fix them. If you can compile your code fine then it looks like that Typedoc is using a different TSC version or different TSC settings to compile your code then you do.
Leo Vigna
@leovigna
Hello! I'm looking to run Typedoc in watch mode but seem to be running in some infinite loop of file change detections which keeps recompiling the docs. Any suggestions?
Info: Starting compilation in watch mode...
Info: Found 0 errors. Watching for file changes.
Info: Documentation generated at ./docs
Info: File change detected. Starting incremental compilation...
Info: Found 0 errors. Watching for file changes.
Info: Documentation generated at ./docs
Info: File change detected. Starting incremental compilation...
Vishal J
@vishal767
Hi , I'm trying typedoc for the first time , I have a seperate repo to define interfaces and imported to current package via npm, how to add those also to typedoc, I tried to add the path , but its not working
Gerrit Birkeland
@Gerrit0
@leovigna that looks like a bug, if you can set up a reproduction you can share, that'd be a great issue.
@vishal767 if you re-export the types (either under a namespace, or not), that might be a better solution for you. TypeDoc should also let you use declaration files, but those paths can be easier to mess up.

General reminder that this room isn't checked often, you'll get a response much quicker by opening an issue.
Zack Elliott
@zelliott
Hey Typedoc folks, I'm looking to better understand the documentation deltas between running docgen on source ts files + d.ts files (as typedoc does) versus running on strictly d.ts files (as api-extractor does). It's not clear to me - maybe from a philosophical point-of-view - which input makes more sense to generate documentation from. I find many of the arguments from the api-extractor maintainer convincing for why running on d.ts files make sense (see microsoft/rushstack#598), but I'm well aware that there are "gaps" regarding what information is contained in a d.ts file that might make running on ts + d.ts files a better solution (e.g. decorator information - an important part of Angular's API - default values, what else?). Curious what thoughts @Gerrit0 as well as the other typedoc contributors/users have. I'm still ramping up in the TS documentation space, so I thought it'd make sense to solicit feedback from the experts here. Thanks all!
Krisztián Balla
@krisztianb
As far as I know d.ts files contain type definitions for JavaScript code. If you have a TypeScript project and want to document it with TypeDoc you don't need those at all unless you are using JavaScript libraries (from npm for example) and want to have them documented too.