bbc / typescript-docs-verifier

Verifies that MarkDown TypeScript documentation snippets compile
Apache License 2.0
13 stars 4 forks source link

Path to TypeScript config file not forwarded to ts-node #31

Open nflaig opened 5 months ago

nflaig commented 5 months ago

I noticed that the path to TypeScript config file (--project) is not forwarded to ts-node which causes it to load the default tsconfig.json. (see CreateOptions.html#project)

https://github.com/bbc/typescript-docs-verifier/blob/30a2d634b7cae88b68d8cbcbcb873b222ea3b732/src/SnippetCompiler.ts#L38

This does not affect most users as compilerOptions will be overriden but if the default tsconfig file contains ts-node directive then it will apply those.

e.g.

"ts-node": {
  "transpileOnly": true
}

And if transpileOnly is set to true it effectively disables typescript-docs-verifier.

Confirmed locally, setting the project path resolves the issue

configOptions.config.project = project;
nflaig commented 5 months ago

Alternative approach could be to pass nested ts-node options directly, see https://typestrong.org/ts-node/docs/configuration/#via-tsconfigjson-recommended

nflaig commented 1 month ago

@paulbrimicombe is this project sitll active? we can fork it if that's not the case, although I would like to avoid that