Skip to content

Commit 5216a95

Browse files
authored
🤖 Merge PR DefinitelyTyped#73043 [node] v24.1 by @Renegade334
1 parent f31abc6 commit 5216a95

File tree

4 files changed

+70
-2
lines changed

4 files changed

+70
-2
lines changed

types/node/fs.d.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,18 @@ declare module "fs" {
322322
* @since v12.12.0
323323
*/
324324
readSync(): Dirent | null;
325+
/**
326+
* An alias for `dir.close()`.
327+
* @since v24.1.0
328+
* @experimental
329+
*/
330+
[Symbol.dispose](): void;
331+
/**
332+
* An alias for `dir.closeSync()`.
333+
* @since v24.1.0
334+
* @experimental
335+
*/
336+
[Symbol.asyncDispose](): void;
325337
}
326338
/**
327339
* Class: fs.StatWatcher
@@ -4354,7 +4366,7 @@ declare module "fs" {
43544366
* Current working directory.
43554367
* @default process.cwd()
43564368
*/
4357-
cwd?: string | undefined;
4369+
cwd?: string | URL | undefined;
43584370
/**
43594371
* `true` if the glob should return paths as `Dirent`s, `false` otherwise.
43604372
* @default false

types/node/inspector.d.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,6 +1848,30 @@ declare module 'inspector' {
18481848
enabled: boolean;
18491849
}
18501850
}
1851+
namespace Target {
1852+
type SessionID = string;
1853+
type TargetID = string;
1854+
interface TargetInfo {
1855+
targetId: TargetID;
1856+
type: string;
1857+
title: string;
1858+
url: string;
1859+
attached: boolean;
1860+
canAccessOpener: boolean;
1861+
}
1862+
interface SetAutoAttachParameterType {
1863+
autoAttach: boolean;
1864+
waitForDebuggerOnStart: boolean;
1865+
}
1866+
interface TargetCreatedEventDataType {
1867+
targetInfo: TargetInfo;
1868+
}
1869+
interface AttachedToTargetEventDataType {
1870+
sessionId: SessionID;
1871+
targetInfo: TargetInfo;
1872+
waitingForDebugger: boolean;
1873+
}
1874+
}
18511875

18521876
/**
18531877
* The `inspector.Session` is used for dispatching messages to the V8 inspector
@@ -2237,6 +2261,8 @@ declare module 'inspector' {
22372261
*/
22382262
post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void;
22392263
post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', callback?: (err: Error | null) => void): void;
2264+
post(method: 'Target.setAutoAttach', params?: Target.SetAutoAttachParameterType, callback?: (err: Error | null) => void): void;
2265+
post(method: 'Target.setAutoAttach', callback?: (err: Error | null) => void): void;
22402266

22412267
addListener(event: string, listener: (...args: any[]) => void): this;
22422268
/**
@@ -2355,6 +2381,8 @@ declare module 'inspector' {
23552381
* example, when inspector.waitingForDebugger is called
23562382
*/
23572383
addListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
2384+
addListener(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
2385+
addListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
23582386
emit(event: string | symbol, ...args: any[]): boolean;
23592387
emit(event: 'inspectorNotification', message: InspectorNotification<object>): boolean;
23602388
emit(event: 'Runtime.executionContextCreated', message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>): boolean;
@@ -2388,6 +2416,8 @@ declare module 'inspector' {
23882416
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
23892417
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
23902418
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
2419+
emit(event: 'Target.targetCreated', message: InspectorNotification<Target.TargetCreatedEventDataType>): boolean;
2420+
emit(event: 'Target.attachedToTarget', message: InspectorNotification<Target.AttachedToTargetEventDataType>): boolean;
23912421
on(event: string, listener: (...args: any[]) => void): this;
23922422
/**
23932423
* Emitted when any notification from the V8 Inspector is received.
@@ -2505,6 +2535,8 @@ declare module 'inspector' {
25052535
* example, when inspector.waitingForDebugger is called
25062536
*/
25072537
on(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
2538+
on(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
2539+
on(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
25082540
once(event: string, listener: (...args: any[]) => void): this;
25092541
/**
25102542
* Emitted when any notification from the V8 Inspector is received.
@@ -2622,6 +2654,8 @@ declare module 'inspector' {
26222654
* example, when inspector.waitingForDebugger is called
26232655
*/
26242656
once(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
2657+
once(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
2658+
once(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
26252659
prependListener(event: string, listener: (...args: any[]) => void): this;
26262660
/**
26272661
* Emitted when any notification from the V8 Inspector is received.
@@ -2739,6 +2773,8 @@ declare module 'inspector' {
27392773
* example, when inspector.waitingForDebugger is called
27402774
*/
27412775
prependListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
2776+
prependListener(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
2777+
prependListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
27422778
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
27432779
/**
27442780
* Emitted when any notification from the V8 Inspector is received.
@@ -2856,6 +2892,8 @@ declare module 'inspector' {
28562892
* example, when inspector.waitingForDebugger is called
28572893
*/
28582894
prependOnceListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
2895+
prependOnceListener(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
2896+
prependOnceListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
28592897
}
28602898

28612899
/**
@@ -3010,6 +3048,7 @@ declare module 'inspector/promises' {
30103048
NodeWorker,
30113049
Network,
30123050
NodeRuntime,
3051+
Target,
30133052
} from 'inspector';
30143053

30153054
/**
@@ -3346,6 +3385,7 @@ declare module 'inspector/promises' {
33463385
* Enable the `NodeRuntime.waitingForDisconnect`.
33473386
*/
33483387
post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType): Promise<void>;
3388+
post(method: 'Target.setAutoAttach', params?: Target.SetAutoAttachParameterType): Promise<void>;
33493389

33503390
addListener(event: string, listener: (...args: any[]) => void): this;
33513391
/**
@@ -3464,6 +3504,8 @@ declare module 'inspector/promises' {
34643504
* example, when inspector.waitingForDebugger is called
34653505
*/
34663506
addListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
3507+
addListener(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
3508+
addListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
34673509
emit(event: string | symbol, ...args: any[]): boolean;
34683510
emit(event: 'inspectorNotification', message: InspectorNotification<object>): boolean;
34693511
emit(event: 'Runtime.executionContextCreated', message: InspectorNotification<Runtime.ExecutionContextCreatedEventDataType>): boolean;
@@ -3497,6 +3539,8 @@ declare module 'inspector/promises' {
34973539
emit(event: 'Network.loadingFinished', message: InspectorNotification<Network.LoadingFinishedEventDataType>): boolean;
34983540
emit(event: 'NodeRuntime.waitingForDisconnect'): boolean;
34993541
emit(event: 'NodeRuntime.waitingForDebugger'): boolean;
3542+
emit(event: 'Target.targetCreated', message: InspectorNotification<Target.TargetCreatedEventDataType>): boolean;
3543+
emit(event: 'Target.attachedToTarget', message: InspectorNotification<Target.AttachedToTargetEventDataType>): boolean;
35003544
on(event: string, listener: (...args: any[]) => void): this;
35013545
/**
35023546
* Emitted when any notification from the V8 Inspector is received.
@@ -3614,6 +3658,8 @@ declare module 'inspector/promises' {
36143658
* example, when inspector.waitingForDebugger is called
36153659
*/
36163660
on(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
3661+
on(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
3662+
on(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
36173663
once(event: string, listener: (...args: any[]) => void): this;
36183664
/**
36193665
* Emitted when any notification from the V8 Inspector is received.
@@ -3731,6 +3777,8 @@ declare module 'inspector/promises' {
37313777
* example, when inspector.waitingForDebugger is called
37323778
*/
37333779
once(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
3780+
once(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
3781+
once(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
37343782
prependListener(event: string, listener: (...args: any[]) => void): this;
37353783
/**
37363784
* Emitted when any notification from the V8 Inspector is received.
@@ -3848,6 +3896,8 @@ declare module 'inspector/promises' {
38483896
* example, when inspector.waitingForDebugger is called
38493897
*/
38503898
prependListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
3899+
prependListener(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
3900+
prependListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
38513901
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
38523902
/**
38533903
* Emitted when any notification from the V8 Inspector is received.
@@ -3965,6 +4015,8 @@ declare module 'inspector/promises' {
39654015
* example, when inspector.waitingForDebugger is called
39664016
*/
39674017
prependOnceListener(event: 'NodeRuntime.waitingForDebugger', listener: () => void): this;
4018+
prependOnceListener(event: 'Target.targetCreated', listener: (message: InspectorNotification<Target.TargetCreatedEventDataType>) => void): this;
4019+
prependOnceListener(event: 'Target.attachedToTarget', listener: (message: InspectorNotification<Target.AttachedToTargetEventDataType>) => void): this;
39684020
}
39694021

39704022
export {
@@ -3985,6 +4037,7 @@ declare module 'inspector/promises' {
39854037
NodeWorker,
39864038
Network,
39874039
NodeRuntime,
4040+
Target,
39884041
};
39894042
}
39904043

types/node/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "@types/node",
4-
"version": "24.0.9999",
4+
"version": "24.1.9999",
55
"nonNpm": "conflict",
66
"nonNpmDescription": "Node.js",
77
"projects": [

types/node/test/fs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,9 @@ const anyStatFs: fs.StatsFs | fs.BigIntStatsFs = fs.statfsSync(".", { bigint: Ma
10291029
glob("**/*.js", (err, matches) => {
10301030
matches; // $ExpectType string[]
10311031
});
1032+
glob("**/*.js", { cwd: new URL("") }, (err, matches) => {
1033+
matches; // $ExpectType string[]
1034+
});
10321035
glob("**/*.js", { withFileTypes: true }, (err, matches) => {
10331036
matches; // $ExpectType Dirent<string>[]
10341037
});

0 commit comments

Comments
 (0)