Typedoc: Multiple questions: --lib support, tsconfig "extends" option

Created on 30 Jan 2017  路  4Comments  路  Source: TypeStrong/typedoc

Hi,

First of all, thanks for typedoc, its great.

Previously I have forgot to mention I am using just --json output, but it probably can't affect questions I have asked bellow.

I would like to ask if the typedoc supports the --lib (or "lib" option in the tsconfig). --lib is not supported directly (there is no way how to pass it to typedoc) and "lib" seems not to be working as tsc reports errors. I am currently using TypeScript 2.5.1 (from typedoc perspective it should be the same as 2.4) with es2015.promise lib and it seems the typedoc is not able to pass the tsconfig correctly to the compiler as it emits number of errors: "Cannot find promise". Compilation itself works well.

Using TypeScript 2.1.4 from C:\Program Files\NodeJS\node_modules\typedoc\node_modules\typescript\lib
Error: Cannot find global type 'Promise'.
...
 An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option.

Also the tsconfig option "extends" which basically merges two tsconfigs together fails within the typedoc (when I merge everything manually to typedoc.json and pass it as --tsconfig option it works well - except the lib errors ;) ):

TypeError: Cannot convert undefined or null to object
    at TSConfigReader.load (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\utils\options\readers\tsconfig.js:60:36)
    at TSConfigReader.onDiscover (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\utils\options\readers\tsconfig.js:31:18)
    at C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\utils\events.js:256:33
    at triggerApi (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\utils\events.js:106:13)
    at Options.EventDispatcher.trigger (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\utils\events.js:250:13)
    at Options.read (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\utils\options\options.js:73:14)
    at CliApplication.Application.bootstrap (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\application.js:37:22)
    at CliApplication.bootstrap (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\cli.js:32:49)
    at CliApplication.Application [as constructor] (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\application.js:33:15)
    at new CliApplication (C:\Program Files\NodeJS\node_modules\typedoc\dist\lib\cli.js:29:23)

I am merging these files:

tsconfig.common.json:

{
  // TypeScript 2.1 compiler configuration
  // COMMON CONFIGURATION (DEBUG/RELEASE)

  "compileOnSave": true,
  "compilerOptions": {
    // output file (single js file will be generated)
    "outFile": "../../js/ajs.js",
    // target ECMA version
    "target": "es5",
    // libs to be used during compilation
    "lib": [ "dom", "es2015.promise", "es5" ],
    // moule system to be used (none, AMD, CommonJS, UMD, System, ES2015)
    "module": "none",
    // don't emit any output when compilation fails
    "noEmitOnError": true,
    // don't emit BOM
    "emitBOM": false,
    // preserve const enums (don't delete from generated code)
    "preserveConstEnums": true,
    // implicit any
    "noImplicitAny": false,
    // TSX/JSX compilation support
    "jsx": "react",
    // ajs.debug.tsx is the React.js replacement but for Ajs debugging purposes only
    "reactNamespace": "AjsDebugTsxFactory"
  },
  "include": [
    "./src/**/*"
  ]
}

tsconfig.Debug.json
{
  // TypeScript 2.1 compiler configuration
  // DEBUG CONFIGURATION

  "extends": "./tsconfig.common.json",

  "compilerOptions": {
    // generate .d.ts declaration file
    "declaration": true,
    // generate source maps
    "sourceMap": true,
    // remove comments
    "removeComments": false
  }

}

tsconfig.json
{ "extends" : "./tsconfig.Debug.json" }

Most helpful comment

I'm going to close this issue in favour of #301.

@danielweck Please refrain from "+1" or other meaningless comments. It doesn't really change anything for maintainers other than adding noise. If you'd like to contribute productively, we're open to accepting PRs or discussions on solving the issue. The other issue with "+1" is that I don't even know what the "+1" is for - did you want the --lib feature? Or extends? I'm pretty sure extends already works, but if it doesn't you could start by adding a comment with information on what doesn't work instead of "+1".

@aciccarello We should look into making those tests easier to add, extends is something we should be able to quickly add to our current suite of tests.

All 4 comments

I've been tracking the tsconfig support on #301. You can see the related issues and PRs there.

Great, thanks for links. I plan to take a look on these two issues but I am quiet busy with Ajs and AjsDoc so don't know when I'll find time for it. Hopefully till end of February.

+1

I'm going to close this issue in favour of #301.

@danielweck Please refrain from "+1" or other meaningless comments. It doesn't really change anything for maintainers other than adding noise. If you'd like to contribute productively, we're open to accepting PRs or discussions on solving the issue. The other issue with "+1" is that I don't even know what the "+1" is for - did you want the --lib feature? Or extends? I'm pretty sure extends already works, but if it doesn't you could start by adding a comment with information on what doesn't work instead of "+1".

@aciccarello We should look into making those tests easier to add, extends is something we should be able to quickly add to our current suite of tests.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShadowManu picture ShadowManu  路  4Comments

mcmath picture mcmath  路  3Comments

3nsoft picture 3nsoft  路  3Comments

rbuckton picture rbuckton  路  3Comments

jumpinjackie picture jumpinjackie  路  4Comments