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

notDocumented validation false positive #2291

Closed
Gerrit0 opened this issue May 29, 2023 · 1 comment
Closed

notDocumented validation false positive #2291

Gerrit0 opened this issue May 29, 2023 · 1 comment
Labels
bug Functionality does not match expectation

Comments

@Gerrit0
Copy link
Collaborator

Gerrit0 commented May 29, 2023

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)

@Gerrit0
Copy link
Collaborator Author

Gerrit0 commented May 29, 2023

@jstritch this is a different problem, pulling it into it's own issue for easier tracking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality does not match expectation
Projects
None yet
Development

No branches or pull requests

1 participant