Microsoft/TypeScript

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

Open

#35,962 opened on 2020年1月2日

GitHub で見る
 (7 comments) (0 reactions) (0 assignees)TypeScript (6,726 forks)batch import
BugDomain: JavaScriptEffort: ModerateHelp Wanted

Repository metrics

Stars
 (48,455 stars)
PR merge metrics
 (平均マージ 6d 17h) (30d で 9 merged PRs)

説明

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.

コントリビューターガイド