created: 2019-10-12T04:05:11.000Z

@types/nodeを使う

@types/nodeをいれておくと
fsなどnodeのデフォルトのモジュールで型の補完がきくようになる

@types/node のバージョンは node のバージョンと対応している

Simply, the major version and minor version tagged in the semver string of @types/node is exactly corresponding to the node's version.

index.d.ts を見てもそんなことが書いてある

$ head -3 ./node_modules/@types/node/index.d.ts
// Type definitions for Node.js 10.14
// Project: http://nodejs.org/
// Definitions by: Microsoft TypeScript <https://github.com/Microsoft>

なのでnodeのバージョンと近いものを入れておく
(バージョンによっては@types/nodeがなかったりする)

$ node --version
v10.15.0
$ yarn add --dev @types/node@10.14.21

参考

経済数学の直観的方法 確率・統計編 (ブルーバックス)
[ad] 経済数学の直観的方法 確率・統計編 (ブルーバックス)
長沼伸一郎 (Kindle版)