Skip to content

Is it possible to read the options directly from tsconfig? #480

Closed
@alexewerlof

Description

@alexewerlof

Given that most cli options are very similar to tsc, I usually end up require()ing tsconfig.json and manually map it to the typedoc options in typedoc.js. This procedure is tedious and error-prone. I was thinking if it's possible for typedoc to directly read the configs from a provided tsconfig file and take its options from there.
For example:

  • module (mode can initialize itself from module and isolatedModules tsc options)
  • target
  • includeDeclarations
  • exclude
  • include (why not?)

I'm using a couple of tsconfig files (that extend a base).

let tsconfigSrc = require('./src/tsconfig-src');
const packageJson = require('./package');


if (tsconfigSrc.extends) {
    // Error prone. This is not how extend works.
    Object.assign(require(tsconfigSrc.extends), tsconfigSrc);
}

exports.target = tsconfigSrc.compilerOptions.target;
exports.entryPoint = packageJson.main;
exports.name = `${packageJson.name} v${packageJson.version}`;
exports.mode = 'modules';
exports.module = tsconfigSrc.compilerOptions.
exports.includeDeclarations = tsconfigSrc.compilerOptions.declaration;
exports.includes = include;
exports.exclude = tsconfigSrc.exclude;

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions