Skip to content

Inconsistent behavior with @types when using tsc with a tsconfig #9785

Description

@poke

When using TypeScript 2, I get an inconsistent behavior for importing type definitions from @types when using tsc with an explicit tsconfig.json path versus not specifying one.

I have the following setup:

package.json

{
  "name": "typings-test",
  "devDependencies": {
    "@types/es6-shim": "*",
    "typescript": "^2.0.0"
  }
}

tsconfig.json

{}

test.ts

let x = new Set<string>();

After installing all dependencies with npm install, I call tsc once without arguments and once with -p .:

$ typings-test> tsc
$ typings-test> tsc -p .
test.ts(1,13): error TS2304: Cannot find name 'Set'.

As you can see, the latter fails because it cannot find a definition for Set. So the types that are located in node_modules/@types/es6-shim/index.d.ts are not loaded in this case.

Metadata

Metadata

Assignees

Labels

@typesRelates to working with .d.ts files (declaration/definition files) from DefinitelyTypedBugA bug in TypeScriptFixedA PR has been merged for this issueNeeds More InfoThe issue still hasn't been fully clarified

Type

No type
No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions