Skip to content

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

Closed
@blakeembrey

Description

@blakeembrey

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;

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