microsoft / microsoft/TypeScript
[API] Expose globals declared by a source file
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
With TypeScript 6.x, TypeDoc supports documenting global files by documenting the globals defined in that file.
This was done somewhat hackily with:
```ts
result = checker.getSymbolsInScope(node, ts.SymbolFlags.ModuleMember)
.filter((s) =>
s
.getDeclarations()
?.some((d) => d.getSourceFile() === sourceFile)
);
```
@jakebailey told me on Discord that there is `SourceFile.Locals`, which would be a better way to get this information, but this isn't exposed in the JS API, so I'd like to request that!
Ref: https://github.com/TypeStrong/typedoc/issues/3098
Contributor guide
Assessment
This issue has not been assessed yet.