Skip to content

Typings not seen from subfolder when having own tsconfig.json #10221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dbaeumer opened this issue Aug 9, 2016 · 3 comments
Closed

Typings not seen from subfolder when having own tsconfig.json #10221

dbaeumer opened this issue Aug 9, 2016 · 3 comments
Labels
Fixed A PR has been merged for this issue

Comments

@dbaeumer
Copy link
Member

dbaeumer commented Aug 9, 2016

TypeScript Version: 2.0.0 beta

Folders

root
    app.ts
    tsconfig.json
    tests
       tsconfig.json
       test.ts
  • use TS 2.0. Instruct VS Code to us TS 2.0 with "typescript.tsdk": "./node_modules/typescript/lib"
  • In root install node typings using npm install @types/node
  • following content for tsconfig.json in tests
{
    "compilerOptions": {
        "module": "commonjs",
        "inlineSourceMap": true,
        "inlineSources": true,
    }
}
  • in tests.ts add
import * as fs from 'fs'

Observer: the import is an error. The compile can't find the node typings

Why is this the case. Should the compiler look for a node_modules folder up the tree for typings. Add
a property types with [ "node" ] fixes the issue.

@aluanhaddad
Copy link
Contributor

If the subdirectory contains a project which is built or loaded with a different set of options this is actually helpful behavior.

@yortus
Copy link
Contributor

yortus commented Aug 11, 2016

Looks like same problem as here: #9208 (comment)

@mhegazy
Copy link
Contributor

mhegazy commented Dec 14, 2016

This should be working as intended with latest.

@mhegazy mhegazy closed this as completed Dec 14, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Dec 14, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants