This "package" hosts multi-lingual docs for the TSConfig. As much as possible is based
off pulling data from require("typescript")
then augmented with markdown from inside the
./copy
folder.
Roughly:
TypeScript Compiler + `tsconfigRules.ts` -> `generateJSON.ts` -> JSON (in output) -> `generateMarkdown.ts` -> Markdown (in output)
This happens per-language with fallbacks to English for any missing docs.
To improve a single compiler option's documentation; all you need to do is go into the ./copy
folder and
edit the page option in markdown and send a PR. No need to leave GitHub.
Then, during a deploy, all of the markdown files are bundled together and any merged changes are uploaded.
If you'd like to create a new language:
Create a new subfolder in ./copy
with your language code and then make sure the files you work on have the same
name as English and your changes will overwrite the English version. You will need
The TSConfig reference is created by a two step process:
- Creating the JSON dump of all the useful info via
./scripts/generateJSON.ts
which you can find in./data
. - A script which uses the JSON, and the copy to generate per-language markdown docs which are picked up by the typescriptlang-org Gatsby site at
http://localhost:8000/tsconfig
You can run these commands from the root of the repo:
pnpm run --filter=tsconfig-reference generate-json
pnpm run --filter=tsconfig-reference generate-markdown
You can validate any codeblocks which use twoslash via the script:
pnpm run --filter=tsconfig-reference test
# or to just run the linter without a build
pnpm run --filter=tsconfig-reference lint
# or to just one one linter
pnpm run --filter=tsconfig-reference lint resolveJson
You can debug twoslash by setting the environment var DEBUG="*"
in all of these too.