Merge pull request #10538 from Microsoft/find-declarations-of-js-module-export

Fix crash when checking module exports for export=
This commit is contained in:
Nathan Shively-Sanders
2016-08-25 16:14:13 -07:00
committed by GitHub
11 changed files with 123 additions and 7 deletions

View File

@@ -0,0 +1,2 @@
export var x;
export = {};

View File

@@ -0,0 +1,36 @@
// @module: commonjs
// @moduleResolution: node
// @allowJs: true
// @traceResolution: true
// @noEmit: true
// @filename: /tsconfig.json
{
"compileOnSave": true,
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"outDir": "bin"
},
"exclude": [ "node_modules" ]
}
// @filename: /node_modules/shortid/node_modules/z/index.js
// z will not be found because maxNodeModulesJsDepth: 0
module.exports = { z: 'no' };
// @filename: /node_modules/shortid/index.js
var z = require('z');
var y = { y: 'foo' };
module.exports = y;
// @filename: /typings/index.d.ts
declare module "shortid" {
export var x: number;
}
// @filename: /index.ts
/// <reference path="/typings/index.d.ts" />
import * as foo from "shortid";
foo.x // found in index.d.ts
foo.y // ignored from shortid/index.js

View File

@@ -2,6 +2,7 @@
"compilerOptions": {
"allowJs": true,
"declaration": false,
"moduleResolution": "node"
"moduleResolution": "node",
"maxNodeModuleJsDepth": 2
}
}