Typedoc: Cannot find namespace 'NodeJS'.

Created on 28 Oct 2016  路  7Comments  路  Source: TypeStrong/typedoc

I just updated my project to Typescript 2.0 and Typedoc@latest, and I get this error thrown from Typedoc.

 Cannot find namespace 'NodeJS'.

I had to change a type from number to NodeJS.Timer, because of a change in the type definition for setTimeout in Node type definitions.

Any idea how I can fix this issue?

Most helpful comment

If you also have tsconfig.app.json in your working directory, try to add the attribute node to the types field. Like:
{ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", "module": "es6", "baseUrl": "", "types": ["node"] --> ADD THIS }, "exclude": [ "test.ts", "**/*.spec.ts" ] }

This was working for me..

All 7 comments

Be aware that some of the newer TypeScript 2.0 features are not supported. This could affect how TypeDoc looks up the types for your project.

Are you using the types option in your tsconfig.json? See #311 for the state of that option.

@drochgenius Got the same exact problem. also with number to Timer. Did you already find a solution? thanks

If you also have tsconfig.app.json in your working directory, try to add the attribute node to the types field. Like:
{ "extends": "../tsconfig.json", "compilerOptions": { "outDir": "../out-tsc/app", "module": "es6", "baseUrl": "", "types": ["node"] --> ADD THIS }, "exclude": [ "test.ts", "**/*.spec.ts" ] }

This was working for me..

For me "types": ["node"] didn't work, but it worked by adding this directive:

{
  "compilerOptions":
  {
    ...
    "typeRoots": [
      "node_modules/@types"
    ]
  }
}

PS: I'm in an ionic 3 project running on Windows.

@Murilo-Perrone I thought TypeScript includes all @types definitions if types and typeRoots are not set.

https://www.typescriptlang.org/docs/handbook/tsconfig-json.html#types-typeroots-and-types

This seems to be working, I can't reproduce the issue without specifically configuring TypeDoc to break this.

Please open a new issue with a reproduction if you are still having the problem.

Was this page helpful?
0 / 5 - 0 ratings