Skip to content

Commit 283bf99

Browse files
committed
Cast sys.bufferFrom results in cases where global buffer and sys copy of buffer mismatch
1 parent 5144330 commit 283bf99

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tsserver/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ namespace ts.server {
211211
if (this.fd >= 0) {
212212
const buf = sys.bufferFrom!(s);
213213
// eslint-disable-next-line no-null/no-null
214-
fs.writeSync(this.fd, buf, 0, buf.length, /*position*/ null!); // TODO: GH#18217
214+
fs.writeSync(this.fd, buf as globalThis.Buffer, 0, buf.length, /*position*/ null!); // TODO: GH#18217
215215
}
216216
if (this.traceToConsole) {
217217
console.warn(s);
@@ -884,7 +884,7 @@ namespace ts.server {
884884
}
885885

886886
// Override sys.write because fs.writeSync is not reliable on Node 4
887-
sys.write = (s: string) => writeMessage(sys.bufferFrom!(s, "utf8"));
887+
sys.write = (s: string) => writeMessage(sys.bufferFrom!(s, "utf8") as globalThis.Buffer);
888888
sys.watchFile = (fileName, callback) => {
889889
const watchedFile = pollingWatchedFileSet.addFile(fileName, callback);
890890
return {

0 commit comments

Comments
 (0)