Disallow unsafe type assertions (#18688)

This commit is contained in:
Christian Gunderman
2026-02-10 00:10:15 +00:00
committed by GitHub
parent bce1caefd0
commit fd65416a2f
188 changed files with 592 additions and 47 deletions

View File

@@ -194,6 +194,7 @@ const writeAll = (stream: Writable, data: string): Promise<void> =>
// On Windows, writing directly to the underlying file descriptor bypasses
// application-level stream interception (e.g., by the Ink UI framework).
// This ensures the raw OSC-52 escape sequence reaches the terminal host uncorrupted.
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const fd = (stream as unknown as { fd?: number }).fd;
if (
process.platform === 'win32' &&
@@ -214,6 +215,7 @@ const writeAll = (stream: Writable, data: string): Promise<void> =>
const onError = (err: unknown) => {
cleanup();
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
reject(err as Error);
};
const onDrain = () => {
@@ -251,6 +253,7 @@ export const copyToClipboard = async (text: string): Promise<void> => {
await writeAll(tty!.stream, payload);
if (tty!.closeAfter) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
(tty!.stream as fs.WriteStream).end();
}
return;