Definitelytyped: @types/react-dom 15.5.2 causes typescript build break by adding @types/node dependency

Created on 3 Aug 2017  路  8Comments  路  Source: DefinitelyTyped/DefinitelyTyped

Today my builds started failing because of a conflict between requirejs and node require

This is the compile error I received from typescript:

d:/a/1/s/node_modules/@types/node/index.d.ts(99,13): 
error TS2403: Subsequent variable declarations must have the same type.  
Variable 'require' must be of type 'Require', but here has type 'NodeRequire'.

Lookin at the npm install diff since last known good built showed that it was introduced from react-dom:
image

15.5.1 didn't have the dependency to @types/node

Most helpful comment

I'm running into this issue now. Looks like types/node got added again when react-dom was upgraded to v16.

All 8 comments

+1 same problem here

node_modules/@types/node/index.d.ts(73,13): error TS2451: Cannot redeclare block-scoped variable 'global'.
node_modules/@types/node/index.d.ts(99,13): error TS2300: Duplicate identifier 'require'.
node_modules/@types/react-native/index.d.ts(9036,11): error TS2451: Cannot redeclare block-scoped variable 'global'.
node_modules/@types/react-native/index.d.ts(9037,14): error TS2300: Duplicate identifier 'require'.

Same problem, we had to rollback to the previous version. Breaking setTimeout and other typical functions by assigning them the node types for ex. Node timer.

I'm running into this issue now. Looks like types/node got added again when react-dom was upgraded to v16.

Yes I've noticed this has regressed again with 16.0.3, @mhegazy can you reopen this?

@richardspence can't you reopen?

I'm facing this as well.

{
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-native-web": "^0.3.0",
    "react-scripts-ts": "2.12.0"
  },
  "devDependencies": {
    "@types/jest": "^22.0.1",
    "@types/react": "^16.0.34",
    "@types/react-dom": "^16.0.3"
  }
}
Was this page helpful?
0 / 5 - 0 ratings