Skip to content

notDocumented validation false positive #2291

Closed
@Gerrit0

Description

@Gerrit0

I also observe this passing a type predicate to a generic function. I have configured

{
  "validation": {
    "notDocumented": true
  }
}

The function

/**
 * Parses a JSON string to the specified type.
 * @param guard The type predicate to validate the deserialized object.
 * @param json The JSON string to parse.
 * @typeParam T - The type of the returned objects.
 * @returns The desrialized object, if the type guard function returns true; otherwise, undefined.
 * @category Helper
 */
export function safeParse<T>(guard: (o: unknown) => o is T, json: string): T | undefined {
  try {
    const o = JSON.parse(json) as unknown;
    return guard(o) ? o : undefined;
  } catch {
    return undefined;
  }
}

includes the documentation for guard, as described above. I also observe the following message:

[warning] safeParse.guard.__type, defined in ./src/helpers/safe-parse.ts, does not have any documentation.

Here's a screen shot of the generated documentation.

Screenshot from 2023-05-27 15-39-42

I am using typedoc 0.24.7

To replicate:

  1. clone https://github.com/jstritch/easy-git-annex.git
  2. npm ci
  3. npm run typedoc

Originally posted by @jstritch in #2283 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions