diff options
| author | ST-DDT <[email protected]> | 2022-04-08 16:50:41 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-08 16:50:41 +0200 |
| commit | 71a9918db88dbb0bebfac2b26888ebf8926a3704 (patch) | |
| tree | 3af65d16eae6b49fc494530d6409e35a91b5913a /test/scripts/apidoc/utils.ts | |
| parent | a5727097b1b39d69df5d426058dd635ed55ca0fb (diff) | |
| download | faker-71a9918db88dbb0bebfac2b26888ebf8926a3704.tar.xz faker-71a9918db88dbb0bebfac2b26888ebf8926a3704.zip | |
docs: nice literal unions (#811)
Diffstat (limited to 'test/scripts/apidoc/utils.ts')
| -rw-r--r-- | test/scripts/apidoc/utils.ts | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/scripts/apidoc/utils.ts b/test/scripts/apidoc/utils.ts new file mode 100644 index 00000000..d4d11e8c --- /dev/null +++ b/test/scripts/apidoc/utils.ts @@ -0,0 +1,26 @@ +import type { DeclarationReflection } from 'typedoc'; +import { ReflectionKind } from 'typedoc'; +import { newTypeDocApp, patchProject } from '../../../scripts/apidoc/utils'; + +/** + * Loads the example methods using TypeDoc. + */ +export function loadExampleMethods(): Record<string, DeclarationReflection> { + const app = newTypeDocApp(); + + app.bootstrap({ + entryPoints: ['test/scripts/apidoc/signature.example.ts'], + tsconfig: 'test/scripts/apidoc/tsconfig.json', + }); + + const project = app.convert(); + + patchProject(project); + + const methods: Record<string, DeclarationReflection> = project + .getChildrenByKind(ReflectionKind.Class)[0] + .getChildrenByKind(ReflectionKind.Method) + .reduce((a, v) => ({ ...a, [v.name]: v }), {}); + + return methods; +} |
