BugDomain: LS: Suggestion DiagnosticsHelp Wanted
倉庫指標
- Star
- (48,455 star)
- PR 合併指標
- (平均合併 6天 17小時) (30 天內合併 9 個 PR)
描述
🔎 Search Terms
class unused static field block
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
let BluethootDevice_create;
class BluethootDevice {
#id!: string;
static #allowConstruct = false;
private constructor() {
if (!BluethootDevice.#allowConstruct) {
throw new Error("You cannot instantiate this class directly");
}
}
static {
BluethootDevice_create = (id: string) => {
BluethootDevice.#allowConstruct = true;
const device = new BluethootDevice();
BluethootDevice.#allowConstruct = false;
device.#id = id;
return device;
};
}
get id() {
return this.#id;
}
}
let a = 2;
BluethootDevice_create("aa");
export {}
🙁 Actual behavior
The class BluethootDevice is marked as unused, but it's used by the BluethootDevice_create function
🙂 Expected behavior
BluethootDevice should not be marked as unused
Additional information about the issue
No response