Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple questions: --lib support, tsconfig "extends" option #399

Closed
atomsoftwarestudios opened this issue Jan 30, 2017 · 4 comments
Closed

Comments

@atomsoftwarestudios
Copy link

atomsoftwarestudios commented Jan 30, 2017

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" }
@aciccarello
Copy link
Collaborator

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

@atomsoftwarestudios
Copy link
Author

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.

@danielweck
Copy link

+1

@blakeembrey
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants