Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2461,7 +2461,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
// let obj = { y };
// }
// Here we need to emit obj = { y : m.y } regardless of the output target.
if (languageVersion < ScriptTarget.ES6 || isNamespaceExportReference(node.name)) {
if (modulekind !== ModuleKind.ES6 || isNamespaceExportReference(node.name)) {
// Emit identifier as an identifier
write(": ");
emit(node.name);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
tests/cases/compiler/test.ts(2,19): error TS2307: Cannot find module './missingModule'.


==== tests/cases/compiler/existingModule.ts (0 errors) ====

export var x = 1;

==== tests/cases/compiler/test.ts (1 errors) ====
import {x} from './existingModule';
import {foo} from './missingModule';
~~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find module './missingModule'.

declare function use(a: any): void;

const test = { x, foo };

use(x);
use(foo);
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//// [tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts] ////

//// [existingModule.ts]

export var x = 1;

//// [test.ts]
import {x} from './existingModule';
import {foo} from './missingModule';

declare function use(a: any): void;

const test = { x, foo };

use(x);
use(foo);

//// [existingModule.js]
exports.x = 1;
//// [test.js]
var existingModule_1 = require('./existingModule');
var missingModule_1 = require('./missingModule');
const test = { x: existingModule_1.x, foo: missingModule_1.foo };
use(existingModule_1.x);
use(missingModule_1.foo);
16 changes: 16 additions & 0 deletions tests/cases/compiler/shorthandPropertyAssignmentInES6Module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @target: ES6
// @module: commonjs

// @filename: existingModule.ts
export var x = 1;

// @filename: test.ts
import {x} from './existingModule';
import {foo} from './missingModule';

declare function use(a: any): void;

const test = { x, foo };

use(x);
use(foo);