Skip to content

Include node_module of containing folders in the automatic @types discovery #10617

Closed
@mhegazy

Description

@mhegazy
c:\test>tree /f
│   package.json
│
├───node_modules
│   └───@types
│       └───node
│
└───src
        index.ts
        tsconfig.json

c:\test>cd src

c:\test\src>type index.ts
import * as fs from "fs";

c:\test\src>npm install @types/node
test@1.0.0 c:\test
`-- @types/node@6.0.38

c:\test\src>tsc
index.ts(1,21): error TS2307: Cannot find module 'fs'.

The issue here is that we only including node_modules in the current folder for automatic type discovery. this causes a lot of confusion for users trying to use the new @types package, specially if they are global. ppl do not usually associate the location of their tsconfig.json with it not working, all they see is that sometimes it does and sometimes it does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions