Skip to content

Cannot find name 'Promise'. ( error) #327

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

Closed
jtraband opened this issue Nov 4, 2016 · 9 comments
Closed

Cannot find name 'Promise'. ( error) #327

jtraband opened this issue Nov 4, 2016 · 9 comments

Comments

@jtraband
Copy link

jtraband commented Nov 4, 2016

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

@jonaskello
Copy link

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.

@jtraband
Copy link
Author

jtraband commented Nov 7, 2016

Exactly....

@larsduelfer
Copy link

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

@jonaskello
Copy link

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.

@jtraband
Copy link
Author

jtraband commented Nov 7, 2016

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

@jtraband
Copy link
Author

jtraband commented Nov 7, 2016

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.

@moshmage
Copy link

moshmage commented Dec 17, 2016

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

@jan-molak
Copy link

jan-molak commented Dec 30, 2016

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.

chrisbeech added a commit to PepkorIT/beach-day that referenced this issue Jan 31, 2017
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Mar 15, 2020

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.

@Gerrit0 Gerrit0 closed this as completed Mar 15, 2020
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

6 participants