Skip to content

Commit 1cf58c3

Browse files
committed
fix: IOSession access this before calling super
close microsoft#40399 This makes the TS server crashes if the build target is ES6 or higher.
1 parent ce1947b commit 1cf58c3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tsserver/server.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,9 @@ namespace ts.server {
484484
private constructed: boolean | undefined;
485485

486486
constructor() {
487+
let isConstructed = false;
487488
const event: Event | undefined = (body: object, eventName: string) => {
488-
if (this.constructed) {
489+
if (isConstructed) {
489490
this.event(body, eventName);
490491
}
491492
else {
@@ -539,6 +540,7 @@ namespace ts.server {
539540
}
540541

541542
this.constructed = true;
543+
isConstructed = true;
542544
}
543545

544546
event<T extends object>(body: T, eventName: string): void {

0 commit comments

Comments
 (0)