Skip to content

intentionallyNotExported does not support Windows path separators #1738

@RunDevelopment

Description

@RunDevelopment

Search terms

intentionallyNotExported, Windows

Expected Behavior

When running TypeDoc, I got this warning:

PS C:\Users\micha\Git\refa> npx typedoc
Warning: NodeIdent, defined at src\ast\nodes.ts:64, is referenced by NoParent but not included in the documentation.

So copied the file path of the warning + the type name and used the intentionallyNotExported in my typedoc.json like this:

{
  // other options

  "validation": true,
  "intentionallyNotExported": [
    "src\\ast\\nodes.ts:NodeIdent"
  ]
}

Actual Behavior

This does not work. Luckily, TypeDoc prints a very helpful but also confusing warning:

PS C:\Users\micha\Git\refa> npx typedoc
Warning: NodeIdent, defined at src\ast\nodes.ts:64, is referenced by NoParent but not included in the documentation.
Warning: The following symbols were marked as intentionally not exported, but were either not referenced in the documentation, or were exported:
        src\ast\nodes.ts:NodeIdent

However, using front slashes in the path works:

{
  // other options

  "validation": true,
  "intentionallyNotExported": [
    "src/ast/nodes.ts:NodeIdent"
  ]
}

(Removing the path and only using "NodeIdent" also works as expected.)

It seems like the symbol comparison of the intentionallyNotExported option uses Unix path separators internally and doesn't account for Windows path separators.

The easiest fix for this might be to consistently use Unix path separators internally and to converts the paths from the intentionallyNotExported into Unix paths as well. This could as simple as replacing all backslashes with frontslashes.

Steps to reproduce the bug

Here is a minimal example. Just install all deps (npm ci) and run npx typedoc. You'll see the following on Windows machines:

PS C:\Users\micha\Desktop\example> npx typedoc
Warning: NoParentImpl, defined at src\index.ts:4, is referenced by NoParent but not included in the documentation.
Warning: The following symbols were marked as intentionally not exported, but were either not referenced in the documentation, or were exported:
        src\index.ts:NoParentImpl
Info: Documentation generated at ./docs

Environment

  • Typedoc version: 4.2.4
  • TypeScript version: 0.22.5
  • Node.js version: v16.11.1
  • OS: Win10

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