microsoft / microsoft/TypeScript

[API] Expose globals declared by a source file

Open
#63,871 1 comment 0 reactions 1 assignee Claimed by @andrewbranch View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.