Skip to content

Commit 5a8f90d

Browse files
committed
remove unnecessary ts-expect-error definitions
1 parent 302d0c4 commit 5a8f90d

File tree

6 files changed

+25
-16
lines changed

6 files changed

+25
-16
lines changed

src/node/internal/internal_http_client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ export class ClientRequest extends OutgoingMessage implements _ClientRequest {
168168

169169
const signal = options.signal;
170170
if (signal) {
171-
// @ts-expect-error TS2379 Type incompatibility with exactOptionalPropertyTypes
172171
addAbortSignal(signal, this);
173172
}
174173
let method = options.method;

src/node/internal/internal_net.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ import {
5959
import { isUint8Array, isArrayBufferView } from 'node-internal:internal_types';
6060
import { Duplex } from 'node-internal:streams_duplex';
6161
import { Buffer } from 'node-internal:internal_buffer';
62+
import {
63+
kDestroyed,
64+
kIsReadable,
65+
kIsWritable,
66+
} from 'node-internal:streams_util';
6267
import type {
6368
IpcSocketConnectOpts,
6469
SocketConnectOpts,
@@ -132,13 +137,12 @@ export type SocketOptions = {
132137
handle?: Socket['_handle'];
133138
noDelay?: boolean;
134139
keepAlive?: boolean;
135-
allowHalfOpen?: boolean | undefined;
140+
allowHalfOpen?: boolean;
136141
emitClose?: boolean;
137-
signal?: AbortSignal | undefined;
142+
signal?: AbortSignal;
138143
onread?:
139144
| ({ callback?: () => Uint8Array; buffer?: Uint8Array } & OnReadOpts)
140-
| null
141-
| undefined;
145+
| null;
142146
};
143147

144148
export function Server(): void {
@@ -211,7 +215,14 @@ export declare class Socket extends _Socket {
211215
_read(n: number): void;
212216
_reset(): void;
213217
_getpeername(): Record<string, unknown>;
214-
_writableState: null | unknown[];
218+
_readableState: undefined;
219+
_closed: boolean;
220+
writableErrored: boolean;
221+
readableErrored: boolean;
222+
[kIsReadable]: boolean;
223+
[kIsWritable]: boolean;
224+
[kDestroyed]: boolean;
225+
_writableState: undefined;
215226
_bytesDispatched: number;
216227
_pendingData: SocketWriteData | null;
217228
_pendingEncoding: string;
@@ -331,7 +342,6 @@ export function Socket(this: Socket, options?: SocketOptions): Socket {
331342
// Call Duplex constructor before setting up the abort signal
332343
// This ensures the stream methods are properly set up before
333344
// any abort handling that might call destroy()
334-
// @ts-expect-error TS2379 Type incompatibility with exactOptionalPropertyTypes
335345
Duplex.call(this, options);
336346

337347
if (options.handle) {

src/node/internal/streams_add_abort_signal.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ import type { Readable } from 'node-internal:streams_readable';
3636
import type { Writable } from 'node-internal:streams_writable';
3737
import type { Transform } from 'node-internal:streams_transform';
3838

39-
export function addAbortSignal(
39+
type NodeStream = Readable | Writable | Transform;
40+
41+
export function addAbortSignal<T extends { destroy: (err: Error) => void }>(
4042
signal: unknown,
41-
stream: Readable | Writable | Transform
42-
): Readable | Writable | Transform {
43+
stream: T
44+
): T {
4345
validateAbortSignal(signal, 'signal');
4446
if (!isNodeStream(stream)) {
4547
throw new ERR_INVALID_ARG_TYPE('stream', 'stream.Stream', stream);
@@ -55,7 +57,7 @@ export function addAbortSignal(
5557
onAbort();
5658
} else {
5759
const disposable = addAbortListener(signal, onAbort);
58-
eos(stream, disposable[Symbol.dispose]);
60+
eos(stream as NodeStream, disposable[Symbol.dispose]);
5961
}
6062
return stream;
6163
}

src/node/internal/streams_state.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ let defaultHighWaterMarkObjectMode = 16;
3131

3232
export type HighWaterMarkFromOptions = {
3333
highWaterMark?: number;
34+
[key: string]: number | undefined;
3435
};
3536

3637
export function highWaterMarkFrom(
@@ -41,8 +42,7 @@ export function highWaterMarkFrom(
4142
return options.highWaterMark != null
4243
? options.highWaterMark
4344
: isDuplex
44-
? // @ts-expect-error TS7053 Fix this soon.
45-
(options[duplexKey] as number)
45+
? (options[duplexKey] as number)
4646
: null;
4747
}
4848

src/node/internal/streams_util.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,8 +493,7 @@ export class BufferList {
493493
if (this.length === 0) return '';
494494
let p = this.head;
495495
let ret = '' + p?.data;
496-
// @ts-expect-error TS2365 Plus operand warning.
497-
while ((p = p?.next ?? null) != null) ret += s + p?.data;
496+
while ((p = p?.next ?? null) != null) ret += s + String(p.data);
498497
return ret;
499498
}
500499

src/node/stream/promises.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33
// https://opensource.org/licenses/Apache-2.0
44
//
55
import { promises } from 'node-internal:streams_promises';
6-
export {};
76
export * from 'node-internal:streams_promises';
87
export default promises;

0 commit comments

Comments
 (0)