microsoft / microsoft/TypeScript

`Object` variable declaration conflicts on commonjs

未关闭
#35,478 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Domain: JS Emit
主要语言
Go
星标
111k
派生
14.4k
平均合并
1 天 19 小时
30 天内合并 PR
117

描述

TypeScript Version: 3.7.x-dev.20191203

Search Terms:

Code

export default {}
const Object = {};

Expected behavior:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
{
exports.default = {};
const Object = {};
}

no error

Actual behavior:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = {};
const Object = {};
VM69:2 Uncaught ReferenceError: Cannot access 'Object' before initialization
    at eval (eval at <anonymous> (main-3.js:1239), <anonymous>:2:1)
    at main-3.js:1239

Playground Link: http://www.typescriptlang.org/play/index.html?module=1#code/KYDwDg9gTgLgBAE2AMwIYFcA28DeBfAKAGMIA7AZ3gHkAjAK2CPgF458BuIA

Related Issues:

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定源文件或测试路径。首先使用 CommonJS 输出编译提供的 TypeScript repro,并将生成的 JavaScript 与预期行为进行比较;当该声明不再导致报告的 ReferenceError 时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
compilers
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。