Skip to content
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

tsconfig.json not being read by tsc #5497

Closed
OliverJAsh opened this issue Nov 2, 2015 · 6 comments
Closed

tsconfig.json not being read by tsc #5497

OliverJAsh opened this issue Nov 2, 2015 · 6 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@OliverJAsh
Copy link
Contributor

Given:

// tsconfig.json
{
    "compilerOptions": {
        "noImplicitAny": true,
        "module": "commonjs"
    }
}
// main.ts
/// <reference path="./node_modules/immutable/dist/immutable.d.ts" />
import * as Im from 'immutable';
// package.json
{
  "private": true,
  "dependencies": {
    "immutable": "^3.7.5",
    "typescript": "^1.6.2"
  }
}

My tsconfig.json doesn't appear to be read by tsc:

$ ./node_modules/.bin/tsc main.ts
main.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.

Am I missing something?

@jkillian
Copy link

jkillian commented Nov 2, 2015

If you specify input files, tsconfig.json is ignored. (I agree this is slightly surprising behavior.)
Check out this page for more info on tsconfig.json.

@OliverJAsh
Copy link
Contributor Author

Okay, that is surprising. Thanks

@mhegazy
Copy link
Contributor

mhegazy commented Nov 2, 2015

The other option is to use --project <path to tsconfig.json directory> instead.

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Nov 2, 2015
@martellaj
Copy link
Member

Ignore this comment. Leaving in for conversation's sake.

For anyone reading this now, it seems as if the --project option is no longer supported.

@mhegazy
Copy link
Contributor

mhegazy commented Feb 1, 2016

For anyone reading this now, it seems as if the --project option is no longer supported.

@martellaj that is not correct. --project/--p is still a supported feature. as a matter of fact, starting with TS 1.8, --project now supports a full file path. see #2869

@martellaj
Copy link
Member

@mhegazy, my bad! My PC got into a weird state where I had a second version of TypeScript installed and that's where tsc was mapped to. I'll edit my previous comment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

4 participants