Skip to content

Can't re-use exported variable in object literal shorthand (ES6/CommonJS) #8826

Closed

Description

TypeScript Version:

Version 1.9.0-dev.20160525-1.0

Code

export const test = 'test'

export function foo () {
  run({ test })
}
tsc index.ts --target es6 --module commonjs

Expected behavior: Output using exports.test alias, or create a local test variable.

"use strict";
exports.test = 'test';
function foo() {
    run({ test: exports.test });
}
exports.foo = foo;

Actual behavior: Test is undefined.

"use strict";
exports.test = 'test';
function foo() {
    run({ test });
}
exports.foo = foo;

Activity

  1. yuit commented on Jun 13, 2016

    @yuit
    Contributor

    Daniel Rosenwasser (@DanielRosenwasser) Mohamed Hegazy (@mhegazy) considering moving this to 2.1 as this is an emitter bug which will then have to be redo in again in "transforms" branch

  2. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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