mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-02 14:48:32 -05:00
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:
@@ -0,0 +1,2 @@
|
||||
export var x;
|
||||
export = {};
|
||||
36
tests/cases/compiler/maxNodeModuleJsDepthDefaultsToZero.ts
Normal file
36
tests/cases/compiler/maxNodeModuleJsDepthDefaultsToZero.ts
Normal 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
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"declaration": false,
|
||||
"moduleResolution": "node"
|
||||
"moduleResolution": "node",
|
||||
"maxNodeModuleJsDepth": 2
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user