0.66.2
package.json
{
"dependencies": {
"fs-promise": "^2.0.0"
}
}
Install all dependencies of dependencies (fs-promise -> "@types/mz": "0.0.30")
tsc compilation error - [ts] Cannot find module 'mz/fs'.
node -v prints: v7.8.0You cannot import a module that you do not include in your package.json file.
I assume you have a file like this:
index.ts
import mz from 'mz'
If you want to use mz directly, add it to your package.json dependencies (pnpm i -S mz).
Thank you, captain obvious! 馃槅 So I will explain with more details:
The problem is that when I import fs-promise and want to use something like fs.writeFile() I got an error like Property 'writeFile' does not exist on type .... But it exist that fs-promise extends fs-extra which extends built-in fs. So I looked deep in type declaration and there is export * from "fs-extra"; but I got this error on red:

Just because pnpm doesn't install all dependencies of my dependencies as I said 馃槈 I checked twice, there's no @types/fs-extra in any node_modules folder, while npm and yarn works like a charm.
(part of fs-promise package.json:)
```json
{
"dependencies": {
"any-promise": "^1.3.0",
"fs-extra": "^2.0.0",
"mz": "^2.6.0",
"thenify-all": "^1.6.0"
},
"devDependencies": {
"@types/fs-extra": "0.0.37",
"@types/mz": "0.0.30",
"mocha": "^3.0.0",
"es6-promise": "^4.0.0",
"rsvp": "^3.0.0",
"bluebird": "^3.0.0",
"when": "^3.0.0",
"q": "^1.0.0"
}
}
@types/fs-extra should be a regular dependency in the fs-promise package.json, not a dev dependency. See https://github.com/Microsoft/types-publisher/issues/81
This shouldn't work in npm or yarn either should it? devDependencies should only be installed for the top-level dep.
Just tried with npm3 and yarn. Same issue. You must have something else in your package.json file that has a regular dependency of @types/fs-extra. It would be accessible because npm3 flattens the node_modules - but technically it shouldn't be accessible.
It is exactly this reason that pnpm is superior (not flattening), because if you removed the module that declared it as a regular dependency at some later point or the module removed it as a regular dependecy and you auto-updated, this error would arise out of the blue and be tricky to figure out.
Just tried with npm3 and yarn. Same issue. You must have something else in your package.json file that has a regular dependency of @types/fs-extra. It would be accessible because npm3 flattens the node_modules - but technically it shouldn't be accessible.
That makes sense but I searched and only fs-promise requires @types/fs-extra. It worked before because I had the earlier version before the "fix": https://github.com/kevinbeaty/fs-promise/commit/90fd3d42d4b48a88fa46c69f03825534e7c791e2
The problem should be gone with moving to @types/fs-extra 3.0.0, I will check that later. So closing the issue as it works as intended 馃槈