Skip to content

Commit 55e2e15

Browse files
authored
Use webworker typings for webServer (#46944)
Updates `webServer.ts` to include the webworker typings. This means we don't have to redeclare the web globals we use in this file
1 parent 092018b commit 55e2e15

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/tsserver/webServer.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
/*@internal*/
2-
namespace ts.server {
3-
declare const addEventListener: any;
4-
declare const postMessage: any;
5-
declare const close: any;
6-
declare const location: any;
7-
declare const XMLHttpRequest: any;
8-
declare const self: any;
92

3+
/// <reference lib="webworker" />
4+
5+
namespace ts.server {
106
const nullLogger: Logger = {
117
close: noop,
128
hasLevel: returnFalse,
@@ -86,7 +82,7 @@ namespace ts.server {
8682
}
8783

8884
function hrtime(previous?: [number, number]) {
89-
const now = self.performance.now(performance) * 1e-3;
85+
const now = self.performance.now() * 1e-3;
9086
let seconds = Math.floor(now);
9187
let nanoseconds = Math.floor((now % 1) * 1e9);
9288
if (previous) {
@@ -109,7 +105,7 @@ namespace ts.server {
109105
exit() {
110106
this.logger.info("Exiting...");
111107
this.projectService.closeLog();
112-
close(0);
108+
close();
113109
}
114110

115111
listen() {

0 commit comments

Comments
 (0)