Don't treat object properties as potential JS contructors without JSDoc class tag (#49735)

This commit is contained in:
Jake Bailey
2022-08-10 14:19:19 -04:00
committed by GitHub
parent 382f0c3af3
commit 5fbf3b04dc
10 changed files with 324 additions and 5 deletions

View File

@@ -0,0 +1,30 @@
// @allowJs: true
// @noEmit: true
// @checkJs: true
// @filename: index.js
const a1 = {
foo() {
this.x = 0;
}
}
const a2 = {
foo: function() {
this.x = 0;
}
}
const b1 = {
/** @class */
foo() {
this.x = 0;
}
}
const b2 = {
/** @class */
foo: function() {
this.x = 0;
}
}

View File

@@ -0,0 +1,21 @@
// @allowJs: true
// @outDir: out
// @filename: index.js
export { }
let obj = {
x: 10,
y: [1],
fun: function() {
this.x = 1
this/*1*/
},
f2: function() {
this.x
this/*2*/
},
f3: (function() {
this.x = 1
this/*3*/
}),
}