-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Description
TypeScript Versions: 3.1.0-rc.20180911, 3.1.0-dev.20180914
Not an issue in 3.1.0-dev.20180831 (bisected to #26908)
Search Terms:
does not exist global write module
Code
// test.js
const INPUT = process.argv;
process.env.ENV_VAR = 'val';
module.exports = INPUT;
Run tsc --noEmit --allowJs --checkJs
with @types/node
available (see below for a non-node example).
Expected behavior:
No error.
Actual behavior:
error TS2339: Property 'argv' does not exist on type 'typeof process'.
Not a problem in typescript code. When all the example lines are present, the definition and type definition of process
now point to the process.env.ENV_VAR
line instead of to @types/node
.
To get the bug, either module.exports
needs to be set or a file needs to be required or imported, so I assume it being a module is important. Writing to anything on process
seems to trigger it, not just a sub-property (so e.g. process.env = {ENV_VAR: 'val'};
would also trigger the bug, though probably not a good idea in real code :).