Effect-TS / docgen

An opinionated documentation generator for Effect projects
https://effect-ts.github.io/docgen
MIT License
36 stars 8 forks source link

Namespace examples not typechecked #87

Closed vecerek closed 3 weeks ago

vecerek commented 3 weeks ago

What version of Effect is running?

No response

What steps can reproduce the bug?

  1. Set enforceExamples: true in the config
  2. Have an exported namespace with JSDoc (no @example)
  3. Run docgen

With the above configuration, you will get the expected Missing @example tag in ... error message.

  1. Add @example to your namespace JSDoc, but make sure it has a compilation error in it, something like:
    const a: number = "42"
  2. Run docgen

What is the expected behavior?

Docgen should fail with a compilation error on the added @example under the namespace JSDoc.

What do you see instead?

Docgen succeeds, rendering an invalid TS example.

Additional information

Either typecheck examples under namespaces, too, or do not enforce examples on namespaces regardless of the configuration.