Typedoc: Cannot find name 'Promise'. ( error)

Created on 4 Nov 2016  路  9Comments  路  Source: TypeStrong/typedoc

I am running

typedoc --out ./docs --target ES6 --includeDeclarations ./src

and I get a number of "Cannot find name 'Promise'." errors. What am i missing?

I am using TypeDoc 0.5.1

Most helpful comment

Same problem here as well, although I can kind of get around it by ignoring the compiler errors:

typedoc --out ./docx/ --target ES6 --tsconfig ./tsconfig.json --exclude node_modules --ignoreCompilerErrors src/

It ain't pretty, but the docs get generated.

All 9 comments

Are you using TS 2.0 and specifying the lib option to something like "lib": ["dom", "es2015"] in tsconfig.json? Promise is part of the ES6 API and the typings/existence of that is controlled by this option. Seems like typedoc does not support this option yet. I am having the same problem with Map and Set.

Exactly....

Same problem here, but we are targetting ES5. Seems that happened since using @Types in an Angular 2 project.

This is related to #315. There was a fix merged to ignore the lib option in #308 which now makes it possible to run typedoc but since it does not pass along the lib option to the compiler the compiler cannot find the typings for ES6 API like Promise, Map, Set etc.

So is there a workaround, or do we just wait....?

ok, workaround for now is to have the tsconfig have a target of 'es6' when generating files with TypeDoc. So basically using a different tsconfig for typeDoc then for actual code generation.

This is still happening, even when targeting ES6:

$ typedoc --mode modules --out ./docx/ --target "ES6" src/

Using TypeScript 2.0.6 from c:\Users\Mosh Mage\AppData\Roaming\npm\node_modules\typedoc\node_modules\typescript\lib
Error: c:/Users/Mosh Mage/WebstormProjects/rxjs-SocketIO-client/node_modules/rxjs/Observable.d.ts(67)
 Cannot find name 'Promise'.
Error: c:/Users/Mosh Mage/WebstormProjects/rxjs-SocketIO-client/node_modules/rxjs/Observable.d.ts(67)
 Cannot find name 'Promise'.

Yes. I do have the @types/ for all that, ntsc barfs no error

Same problem here as well, although I can kind of get around it by ignoring the compiler errors:

typedoc --out ./docx/ --target ES6 --tsconfig ./tsconfig.json --exclude node_modules --ignoreCompilerErrors src/

It ain't pretty, but the docs get generated.

I suspect this is due to using an older version of TypeDoc than your project uses - with 0.17 TypeDoc moved to a peer dependency and this should not longer be an issue. Please open a new issue if you are having compile errors when using TypeDoc but not when compiling with tsc.

Was this page helpful?
0 / 5 - 0 ratings