Microsoft/TypeScript

No error for undeclared #private property in `.js` files

开放

#35,962 创建于 2020年1月2日

 (7 条评论) (0 个反应) (0 位负责人)TypeScript (13,395 个派生)batch import
BugDomain: JavaScriptEffort: ModerateHelp Wanted

仓库指标

星标
 (108,860 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

class Thing {
    /**
     * @param prop {string}
     */
    constructor(prop) {
        this.#prop = prop;
    }
}

This class assigns to #prop, but it's an error to use #prop without declaring it.

This is reported as a SyntaxError, so this should report an error even outside of checkJs.

贡献者指南