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

Test harness doesn't correctly exclude d.ts from an included tsconfig #10539

Closed
sandersn opened this issue Aug 25, 2016 · 1 comment · Fixed by #32014
Closed

Test harness doesn't correctly exclude d.ts from an included tsconfig #10539

sandersn opened this issue Aug 25, 2016 · 1 comment · Fixed by #32014
Labels
Infrastructure Issue relates to TypeScript team infrastructure

Comments

@sandersn
Copy link
Member

Code

// @module: commonjs
// @moduleResolution: node
// @allowJs: true
// @noEmit: true
// @traceResolution: true

// @filename: c:/root/tsconfig.json
{
    "compileOnSave": true,
    "compilerOptions": {
        "module": "commonjs",
        "moduleResolution": "node",
        "outDir": "bin"
    },
    "exclude": [ "bah" ]
}

// @filename: c:/root/node_modules/shortid/index.js
module.exports = { fromNodeModules: 'foo' };

// @filename: c:/root/bah/index.d.ts
declare module "shortid" {
    export var fromTypings: number;
}

// @filename: c:/root/index.ts
// no triple-slash reference means that index.d.ts is not used
import * as foo from "shortid";
foo.fromTypings     // ignored
foo.fromNodeModules // found

Expected behavior:

Error at foo.fromTypings

Actual behavior:

Error at foo.fromNodeModules

@weswigham
Copy link
Member

There's an assert in the runner reminding test authors that include and files in a tsconfig in a test are not respected (since a test program is not assembled via tsconfig today), however there's no check for just an exclude (and if you don't want all provided files included, you're meant to use @noImplicitReferences). Tis a simple addition to the existing assertion to make the limitation more obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issue relates to TypeScript team infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants