Skip to content

Shorthand property names issue with target ES6 and commonjs module #5573

@ghalle

Description

@ghalle

Using typescript@next (1.8.0-dev.20151109) and the following compilerOptions:

"compilerOptions": {
    "target": "ES6",
    "module": "commonjs"
}

Any code using named import as a shorthand property will result in invalid code being generated.

Example:

import {foo} from './foo';
const test = {
  foo
};

generates

var foo_1 = require('./foo');
const test = {
    foo
};
ReferenceError: foo is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions