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

Fix crash when checking module exports for export= #10538

Merged
merged 3 commits into from
Aug 25, 2016

Conversation

sandersn
Copy link
Member

Fixes #10460 and fixes #10522

This PR also makes maxNodeModuleJsDepth default to 0 so that incorrect tsconfigs now let the compiler spend less time compiling JS that is found in node_modules (especially since most people will already have the d.ts and want ignore the JS anyway).

jsconfig still defaults to 2.

Also make maxNodeModuleJsDepth default to 0 so that incorrect tsconfigs
now let the compiler spend less time compiling JS that is found in
node_modules (especially since most people will already have the d.ts
and want ignore the JS anyway). jsconfig still defaults to 2.
@sandersn
Copy link
Member Author

@andy-ms and @vladima can you take a look?

@sandersn
Copy link
Member Author

A baselining test that asserts that allowJs: true + "exclude": [ "typings" ] produces the node_modules-js-compilation behaviour from #10460 is blocked by a bug in the test harness (#10539). And I think it's a pretty low-value test anyway.

@sandersn
Copy link
Member Author

@mhegazy you should also know about this fix.

// @traceResolution: true
// @noEmit: true

// @filename: c:/root/tsconfig.json
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would replace c:/root/ with just /.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@ghost
Copy link

ghost commented Aug 25, 2016

👍

/// <reference path="c:/root/typings/index.d.ts" />
import * as foo from "shortid";
foo.x // found in index.d.ts
foo.y // ignored from shortid/index.ts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shortid/index.js and not shortid/index.ts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@mhegazy
Copy link
Contributor

mhegazy commented Aug 25, 2016

can you add the same test with maxNodeModuleJsDepth == 1 and then the error message should be on x and not y.

@mhegazy
Copy link
Contributor

mhegazy commented Aug 25, 2016

👍

@sandersn
Copy link
Member Author

Actually if there is a d.ts, then it is always used. There is no way to get the compiler to prefer node_modules if it can find a d.ts.

@@ -4,7 +4,7 @@
// @traceResolution: true
// @noEmit: true

// @filename: c:/root/tsconfig.json
// @filename: tsconfig.json
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to include the / in front or else your own directory will show up in the trace.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good to know, I didn't notice that. fixed.

@sandersn
Copy link
Member Author

Travis is down, but all tests pass when I merge master back into the branch, so I'll go ahead and merge. @yuit

@sandersn sandersn merged commit 0041d5c into master Aug 25, 2016
@sandersn sandersn deleted the find-declarations-of-js-module-export branch August 25, 2016 23:14
@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
None yet
Projects
None yet
3 participants