@types/node 22.16.0 → 24.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- node v22.16/README.md → node/README.md +2 -2
- node v22.16/assert.d.ts → node/assert.d.ts +5 -5
- node v22.16/async_hooks.d.ts → node/async_hooks.d.ts +25 -5
- node v22.16/buffer.d.ts → node/buffer.d.ts +1 -4
- node v22.16/child_process.d.ts → node/child_process.d.ts +2 -2
- node v22.16/cluster.d.ts → node/cluster.d.ts +15 -15
- node v22.16/compatibility/iterators.d.ts → node/compatibility/iterators.d.ts +1 -0
- node v22.16/console.d.ts → node/console.d.ts +17 -17
- node v22.16/crypto.d.ts → node/crypto.d.ts +35 -28
- node v22.16/dgram.d.ts → node/dgram.d.ts +1 -1
- node v22.16/diagnostics_channel.d.ts → node/diagnostics_channel.d.ts +1 -1
- node v22.16/dns/promises.d.ts → node/dns/promises.d.ts +1 -27
- node v22.16/dns.d.ts → node/dns.d.ts +18 -72
- node v22.16/domain.d.ts → node/domain.d.ts +1 -1
- node v22.16/events.d.ts → node/events.d.ts +1 -1
- node v22.16/fs/promises.d.ts → node/fs/promises.d.ts +18 -12
- node v22.16/fs.d.ts → node/fs.d.ts +29 -20
- node v22.16/globals.d.ts → node/globals.d.ts +7 -4
- node v22.16/globals.typedarray.d.ts → node/globals.typedarray.d.ts +1 -0
- node v22.16/http.d.ts → node/http.d.ts +3 -80
- node v22.16/http2.d.ts → node/http2.d.ts +6 -3
- node v22.16/https.d.ts → node/https.d.ts +1 -1
- node v22.16/index.d.ts → node/index.d.ts +7 -5
- node v22.16/inspector.d.ts → node/inspector.d.ts +3 -7
- node v22.16/module.d.ts → node/module.d.ts +18 -63
- node v22.16/net.d.ts → node/net.d.ts +2 -5
- node v22.16/os.d.ts → node/os.d.ts +8 -7
- node v22.16/package.json → node/package.json +13 -3
- node v22.16/path.d.ts → node/path.d.ts +1 -1
- node v22.16/perf_hooks.d.ts → node/perf_hooks.d.ts +8 -8
- node v22.16/process.d.ts → node/process.d.ts +21 -9
- node v22.16/punycode.d.ts → node/punycode.d.ts +1 -1
- node v22.16/querystring.d.ts → node/querystring.d.ts +1 -1
- node v22.16/readline/promises.d.ts → node/readline/promises.d.ts +0 -1
- node v22.16/readline.d.ts → node/readline.d.ts +13 -13
- node v22.16/repl.d.ts → node/repl.d.ts +12 -12
- node v22.16/sea.d.ts → node/sea.d.ts +1 -1
- node v22.16/sqlite.d.ts → node/sqlite.d.ts +15 -7
- node v22.16/stream/web.d.ts → node/stream/web.d.ts +0 -4
- node v22.16/stream.d.ts → node/stream.d.ts +8 -19
- node v22.16/string_decoder.d.ts → node/string_decoder.d.ts +1 -1
- node/test.d.ts +2318 -0
- node v22.16/timers/promises.d.ts → node/timers/promises.d.ts +1 -1
- node v22.16/timers.d.ts → node/timers.d.ts +1 -1
- node v22.16/tls.d.ts → node/tls.d.ts +2 -48
- node v22.16/trace_events.d.ts → node/trace_events.d.ts +6 -6
- node v22.16/compatibility/disposable.d.ts → node/ts5.1/compatibility/disposable.d.ts +0 -2
- node/ts5.1/index.d.ts +98 -0
- node/ts5.6/compatibility/float16array.d.ts +71 -0
- node v22.16/ts5.6/globals.typedarray.d.ts → node/ts5.6/globals.typedarray.d.ts +1 -0
- node v22.16/ts5.6/index.d.ts → node/ts5.6/index.d.ts +9 -5
- node/ts5.7/compatibility/float16array.d.ts +72 -0
- node/ts5.7/index.d.ts +96 -0
- node v22.16/tty.d.ts → node/tty.d.ts +1 -1
- node v22.16/url.d.ts → node/url.d.ts +61 -19
- node v22.16/util.d.ts → node/util.d.ts +7 -298
- node v22.16/v8.d.ts → node/v8.d.ts +29 -65
- node v22.16/vm.d.ts → node/vm.d.ts +17 -10
- node v22.16/wasi.d.ts → node/wasi.d.ts +1 -1
- node v22.16/worker_threads.d.ts → node/worker_threads.d.ts +8 -2
- node v22.16/zlib.d.ts → node/zlib.d.ts +5 -7
- node v22.16/compatibility/index.d.ts +0 -9
- node v22.16/compatibility/indexable.d.ts +0 -20
- node v22.16/test.d.ts +0 -2175
- {node v22.16 → node}/LICENSE +0 -0
- {node v22.16 → node}/assert/strict.d.ts +0 -0
- {node v22.16 → node}/buffer.buffer.d.ts +0 -0
- {node v22.16 → node}/constants.d.ts +0 -0
- {node v22.16 → node}/dom-events.d.ts +0 -0
- {node v22.16 → node}/stream/consumers.d.ts +0 -0
- {node v22.16 → node}/stream/promises.d.ts +0 -0
- {node v22.16 → node}/ts5.6/buffer.buffer.d.ts +0 -0
@@ -5,7 +5,7 @@
|
|
5
5
|
* ```js
|
6
6
|
* import url from 'node:url';
|
7
7
|
* ```
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/url.js)
|
9
9
|
*/
|
10
10
|
declare module "url" {
|
11
11
|
import { Blob as NodeBlob } from "node:buffer";
|
@@ -420,14 +420,12 @@ declare module "url" {
|
|
420
420
|
* Threads, `Blob` objects registered within one Worker will not be available
|
421
421
|
* to other workers or the main thread.
|
422
422
|
* @since v16.7.0
|
423
|
-
* @experimental
|
424
423
|
*/
|
425
424
|
static createObjectURL(blob: NodeBlob): string;
|
426
425
|
/**
|
427
426
|
* Removes the stored `Blob` identified by the given ID. Attempting to revoke a
|
428
427
|
* ID that isn't registered will silently fail.
|
429
428
|
* @since v16.7.0
|
430
|
-
* @experimental
|
431
429
|
* @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
|
432
430
|
*/
|
433
431
|
static revokeObjectURL(id: string): void;
|
@@ -757,6 +755,54 @@ declare module "url" {
|
|
757
755
|
*/
|
758
756
|
toJSON(): string;
|
759
757
|
}
|
758
|
+
interface URLPatternComponentResult {
|
759
|
+
input: string;
|
760
|
+
groups: Record<string, string | undefined>;
|
761
|
+
}
|
762
|
+
interface URLPatternInit {
|
763
|
+
protocol?: string;
|
764
|
+
username?: string;
|
765
|
+
password?: string;
|
766
|
+
hostname?: string;
|
767
|
+
port?: string;
|
768
|
+
pathname?: string;
|
769
|
+
search?: string;
|
770
|
+
hash?: string;
|
771
|
+
baseURL?: string;
|
772
|
+
}
|
773
|
+
interface URLPatternOptions {
|
774
|
+
ignoreCase?: boolean;
|
775
|
+
}
|
776
|
+
interface URLPatternResult {
|
777
|
+
inputs: (string | URLPatternInit)[];
|
778
|
+
protocol: URLPatternComponentResult;
|
779
|
+
username: URLPatternComponentResult;
|
780
|
+
password: URLPatternComponentResult;
|
781
|
+
hostname: URLPatternComponentResult;
|
782
|
+
port: URLPatternComponentResult;
|
783
|
+
pathname: URLPatternComponentResult;
|
784
|
+
search: URLPatternComponentResult;
|
785
|
+
hash: URLPatternComponentResult;
|
786
|
+
}
|
787
|
+
/**
|
788
|
+
* @since v23.8.0
|
789
|
+
* @experimental
|
790
|
+
*/
|
791
|
+
class URLPattern {
|
792
|
+
constructor(input: string | URLPatternInit, baseURL: string, options?: URLPatternOptions);
|
793
|
+
constructor(input?: string | URLPatternInit, options?: URLPatternOptions);
|
794
|
+
exec(input?: string | URLPatternInit, baseURL?: string): URLPatternResult | null;
|
795
|
+
readonly hasRegExpGroups: boolean;
|
796
|
+
readonly hash: string;
|
797
|
+
readonly hostname: string;
|
798
|
+
readonly password: string;
|
799
|
+
readonly pathname: string;
|
800
|
+
readonly port: string;
|
801
|
+
readonly protocol: string;
|
802
|
+
readonly search: string;
|
803
|
+
test(input?: string | URLPatternInit, baseURL?: string): boolean;
|
804
|
+
readonly username: string;
|
805
|
+
}
|
760
806
|
interface URLSearchParamsIterator<T> extends NodeJS.Iterator<T, NodeJS.BuiltinIteratorReturn, unknown> {
|
761
807
|
[Symbol.iterator](): URLSearchParamsIterator<T>;
|
762
808
|
}
|
@@ -937,34 +983,30 @@ declare module "url" {
|
|
937
983
|
values(): URLSearchParamsIterator<string>;
|
938
984
|
[Symbol.iterator](): URLSearchParamsIterator<[string, string]>;
|
939
985
|
}
|
940
|
-
import {
|
986
|
+
import {
|
987
|
+
URL as _URL,
|
988
|
+
URLPattern as _URLPattern,
|
989
|
+
URLPatternInit as _URLPatternInit,
|
990
|
+
URLPatternResult as _URLPatternResult,
|
991
|
+
URLSearchParams as _URLSearchParams,
|
992
|
+
} from "url";
|
941
993
|
global {
|
942
|
-
interface URLSearchParams extends _URLSearchParams {}
|
943
994
|
interface URL extends _URL {}
|
944
|
-
interface Global {
|
945
|
-
URL: typeof _URL;
|
946
|
-
URLSearchParams: typeof _URLSearchParams;
|
947
|
-
}
|
948
|
-
/**
|
949
|
-
* `URL` class is a global reference for `import { URL } from 'url'`
|
950
|
-
* https://nodejs.org/api/url.html#the-whatwg-url-api
|
951
|
-
* @since v10.0.0
|
952
|
-
*/
|
953
995
|
var URL: typeof globalThis extends {
|
954
996
|
onmessage: any;
|
955
997
|
URL: infer T;
|
956
998
|
} ? T
|
957
999
|
: typeof _URL;
|
958
|
-
|
959
|
-
* `URLSearchParams` class is a global reference for `import { URLSearchParams } from 'node:url'`
|
960
|
-
* https://nodejs.org/api/url.html#class-urlsearchparams
|
961
|
-
* @since v10.0.0
|
962
|
-
*/
|
1000
|
+
interface URLSearchParams extends _URLSearchParams {}
|
963
1001
|
var URLSearchParams: typeof globalThis extends {
|
964
1002
|
onmessage: any;
|
965
1003
|
URLSearchParams: infer T;
|
966
1004
|
} ? T
|
967
1005
|
: typeof _URLSearchParams;
|
1006
|
+
interface URLPatternInit extends _URLPatternInit {}
|
1007
|
+
interface URLPatternResult extends _URLPatternResult {}
|
1008
|
+
interface URLPattern extends _URLPattern {}
|
1009
|
+
var URLPattern: typeof _URLPattern;
|
968
1010
|
}
|
969
1011
|
}
|
970
1012
|
declare module "node:url" {
|
@@ -6,7 +6,7 @@
|
|
6
6
|
* ```js
|
7
7
|
* import util from 'node:util';
|
8
8
|
* ```
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/util.js)
|
10
10
|
*/
|
11
11
|
declare module "util" {
|
12
12
|
import * as types from "node:util/types";
|
@@ -367,19 +367,6 @@ declare module "util" {
|
|
367
367
|
* @since v22.12.0
|
368
368
|
*/
|
369
369
|
export function getSystemErrorMessage(err: number): string;
|
370
|
-
/**
|
371
|
-
* The `util.log()` method prints the given `string` to `stdout` with an included
|
372
|
-
* timestamp.
|
373
|
-
*
|
374
|
-
* ```js
|
375
|
-
* import util from 'node:util';
|
376
|
-
*
|
377
|
-
* util.log('Timestamped message.');
|
378
|
-
* ```
|
379
|
-
* @since v0.3.0
|
380
|
-
* @deprecated Since v6.0.0 - Use a third party module instead.
|
381
|
-
*/
|
382
|
-
export function log(string: string): void;
|
383
370
|
/**
|
384
371
|
* Returns the `string` after replacing any surrogate code points
|
385
372
|
* (or equivalently, any unpaired surrogate code units) with the
|
@@ -650,71 +637,6 @@ declare module "util" {
|
|
650
637
|
* @deprecated Since v4.0.0 - Use `isArray` instead.
|
651
638
|
*/
|
652
639
|
export function isArray(object: unknown): object is unknown[];
|
653
|
-
/**
|
654
|
-
* Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`.
|
655
|
-
*
|
656
|
-
* ```js
|
657
|
-
* import util from 'node:util';
|
658
|
-
*
|
659
|
-
* util.isRegExp(/some regexp/);
|
660
|
-
* // Returns: true
|
661
|
-
* util.isRegExp(new RegExp('another regexp'));
|
662
|
-
* // Returns: true
|
663
|
-
* util.isRegExp({});
|
664
|
-
* // Returns: false
|
665
|
-
* ```
|
666
|
-
* @since v0.6.0
|
667
|
-
* @deprecated Since v4.0.0 - Deprecated
|
668
|
-
*/
|
669
|
-
export function isRegExp(object: unknown): object is RegExp;
|
670
|
-
/**
|
671
|
-
* Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`.
|
672
|
-
*
|
673
|
-
* ```js
|
674
|
-
* import util from 'node:util';
|
675
|
-
*
|
676
|
-
* util.isDate(new Date());
|
677
|
-
* // Returns: true
|
678
|
-
* util.isDate(Date());
|
679
|
-
* // false (without 'new' returns a String)
|
680
|
-
* util.isDate({});
|
681
|
-
* // Returns: false
|
682
|
-
* ```
|
683
|
-
* @since v0.6.0
|
684
|
-
* @deprecated Since v4.0.0 - Use {@link types.isDate} instead.
|
685
|
-
*/
|
686
|
-
export function isDate(object: unknown): object is Date;
|
687
|
-
/**
|
688
|
-
* Returns `true` if the given `object` is an `Error`. Otherwise, returns `false`.
|
689
|
-
*
|
690
|
-
* ```js
|
691
|
-
* import util from 'node:util';
|
692
|
-
*
|
693
|
-
* util.isError(new Error());
|
694
|
-
* // Returns: true
|
695
|
-
* util.isError(new TypeError());
|
696
|
-
* // Returns: true
|
697
|
-
* util.isError({ name: 'Error', message: 'an error occurred' });
|
698
|
-
* // Returns: false
|
699
|
-
* ```
|
700
|
-
*
|
701
|
-
* This method relies on `Object.prototype.toString()` behavior. It is
|
702
|
-
* possible to obtain an incorrect result when the `object` argument manipulates `@@toStringTag`.
|
703
|
-
*
|
704
|
-
* ```js
|
705
|
-
* import util from 'node:util';
|
706
|
-
* const obj = { name: 'Error', message: 'an error occurred' };
|
707
|
-
*
|
708
|
-
* util.isError(obj);
|
709
|
-
* // Returns: false
|
710
|
-
* obj[Symbol.toStringTag] = 'Error';
|
711
|
-
* util.isError(obj);
|
712
|
-
* // Returns: true
|
713
|
-
* ```
|
714
|
-
* @since v0.6.0
|
715
|
-
* @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead.
|
716
|
-
*/
|
717
|
-
export function isError(object: unknown): object is Error;
|
718
640
|
/**
|
719
641
|
* Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and
|
720
642
|
* `extends` keywords to get language level inheritance support. Also note
|
@@ -865,217 +787,6 @@ declare module "util" {
|
|
865
787
|
*/
|
866
788
|
export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger;
|
867
789
|
export { debuglog as debug };
|
868
|
-
/**
|
869
|
-
* Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`.
|
870
|
-
*
|
871
|
-
* ```js
|
872
|
-
* import util from 'node:util';
|
873
|
-
*
|
874
|
-
* util.isBoolean(1);
|
875
|
-
* // Returns: false
|
876
|
-
* util.isBoolean(0);
|
877
|
-
* // Returns: false
|
878
|
-
* util.isBoolean(false);
|
879
|
-
* // Returns: true
|
880
|
-
* ```
|
881
|
-
* @since v0.11.5
|
882
|
-
* @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead.
|
883
|
-
*/
|
884
|
-
export function isBoolean(object: unknown): object is boolean;
|
885
|
-
/**
|
886
|
-
* Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`.
|
887
|
-
*
|
888
|
-
* ```js
|
889
|
-
* import util from 'node:util';
|
890
|
-
*
|
891
|
-
* util.isBuffer({ length: 0 });
|
892
|
-
* // Returns: false
|
893
|
-
* util.isBuffer([]);
|
894
|
-
* // Returns: false
|
895
|
-
* util.isBuffer(Buffer.from('hello world'));
|
896
|
-
* // Returns: true
|
897
|
-
* ```
|
898
|
-
* @since v0.11.5
|
899
|
-
* @deprecated Since v4.0.0 - Use `isBuffer` instead.
|
900
|
-
*/
|
901
|
-
export function isBuffer(object: unknown): object is Buffer;
|
902
|
-
/**
|
903
|
-
* Returns `true` if the given `object` is a `Function`. Otherwise, returns `false`.
|
904
|
-
*
|
905
|
-
* ```js
|
906
|
-
* import util from 'node:util';
|
907
|
-
*
|
908
|
-
* function Foo() {}
|
909
|
-
* const Bar = () => {};
|
910
|
-
*
|
911
|
-
* util.isFunction({});
|
912
|
-
* // Returns: false
|
913
|
-
* util.isFunction(Foo);
|
914
|
-
* // Returns: true
|
915
|
-
* util.isFunction(Bar);
|
916
|
-
* // Returns: true
|
917
|
-
* ```
|
918
|
-
* @since v0.11.5
|
919
|
-
* @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead.
|
920
|
-
*/
|
921
|
-
export function isFunction(object: unknown): boolean;
|
922
|
-
/**
|
923
|
-
* Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`.
|
924
|
-
*
|
925
|
-
* ```js
|
926
|
-
* import util from 'node:util';
|
927
|
-
*
|
928
|
-
* util.isNull(0);
|
929
|
-
* // Returns: false
|
930
|
-
* util.isNull(undefined);
|
931
|
-
* // Returns: false
|
932
|
-
* util.isNull(null);
|
933
|
-
* // Returns: true
|
934
|
-
* ```
|
935
|
-
* @since v0.11.5
|
936
|
-
* @deprecated Since v4.0.0 - Use `value === null` instead.
|
937
|
-
*/
|
938
|
-
export function isNull(object: unknown): object is null;
|
939
|
-
/**
|
940
|
-
* Returns `true` if the given `object` is `null` or `undefined`. Otherwise,
|
941
|
-
* returns `false`.
|
942
|
-
*
|
943
|
-
* ```js
|
944
|
-
* import util from 'node:util';
|
945
|
-
*
|
946
|
-
* util.isNullOrUndefined(0);
|
947
|
-
* // Returns: false
|
948
|
-
* util.isNullOrUndefined(undefined);
|
949
|
-
* // Returns: true
|
950
|
-
* util.isNullOrUndefined(null);
|
951
|
-
* // Returns: true
|
952
|
-
* ```
|
953
|
-
* @since v0.11.5
|
954
|
-
* @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead.
|
955
|
-
*/
|
956
|
-
export function isNullOrUndefined(object: unknown): object is null | undefined;
|
957
|
-
/**
|
958
|
-
* Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`.
|
959
|
-
*
|
960
|
-
* ```js
|
961
|
-
* import util from 'node:util';
|
962
|
-
*
|
963
|
-
* util.isNumber(false);
|
964
|
-
* // Returns: false
|
965
|
-
* util.isNumber(Infinity);
|
966
|
-
* // Returns: true
|
967
|
-
* util.isNumber(0);
|
968
|
-
* // Returns: true
|
969
|
-
* util.isNumber(NaN);
|
970
|
-
* // Returns: true
|
971
|
-
* ```
|
972
|
-
* @since v0.11.5
|
973
|
-
* @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead.
|
974
|
-
*/
|
975
|
-
export function isNumber(object: unknown): object is number;
|
976
|
-
/**
|
977
|
-
* Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript).
|
978
|
-
* Otherwise, returns `false`.
|
979
|
-
*
|
980
|
-
* ```js
|
981
|
-
* import util from 'node:util';
|
982
|
-
*
|
983
|
-
* util.isObject(5);
|
984
|
-
* // Returns: false
|
985
|
-
* util.isObject(null);
|
986
|
-
* // Returns: false
|
987
|
-
* util.isObject({});
|
988
|
-
* // Returns: true
|
989
|
-
* util.isObject(() => {});
|
990
|
-
* // Returns: false
|
991
|
-
* ```
|
992
|
-
* @since v0.11.5
|
993
|
-
* @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead.
|
994
|
-
*/
|
995
|
-
export function isObject(object: unknown): boolean;
|
996
|
-
/**
|
997
|
-
* Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`.
|
998
|
-
*
|
999
|
-
* ```js
|
1000
|
-
* import util from 'node:util';
|
1001
|
-
*
|
1002
|
-
* util.isPrimitive(5);
|
1003
|
-
* // Returns: true
|
1004
|
-
* util.isPrimitive('foo');
|
1005
|
-
* // Returns: true
|
1006
|
-
* util.isPrimitive(false);
|
1007
|
-
* // Returns: true
|
1008
|
-
* util.isPrimitive(null);
|
1009
|
-
* // Returns: true
|
1010
|
-
* util.isPrimitive(undefined);
|
1011
|
-
* // Returns: true
|
1012
|
-
* util.isPrimitive({});
|
1013
|
-
* // Returns: false
|
1014
|
-
* util.isPrimitive(() => {});
|
1015
|
-
* // Returns: false
|
1016
|
-
* util.isPrimitive(/^$/);
|
1017
|
-
* // Returns: false
|
1018
|
-
* util.isPrimitive(new Date());
|
1019
|
-
* // Returns: false
|
1020
|
-
* ```
|
1021
|
-
* @since v0.11.5
|
1022
|
-
* @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead.
|
1023
|
-
*/
|
1024
|
-
export function isPrimitive(object: unknown): boolean;
|
1025
|
-
/**
|
1026
|
-
* Returns `true` if the given `object` is a `string`. Otherwise, returns `false`.
|
1027
|
-
*
|
1028
|
-
* ```js
|
1029
|
-
* import util from 'node:util';
|
1030
|
-
*
|
1031
|
-
* util.isString('');
|
1032
|
-
* // Returns: true
|
1033
|
-
* util.isString('foo');
|
1034
|
-
* // Returns: true
|
1035
|
-
* util.isString(String('foo'));
|
1036
|
-
* // Returns: true
|
1037
|
-
* util.isString(5);
|
1038
|
-
* // Returns: false
|
1039
|
-
* ```
|
1040
|
-
* @since v0.11.5
|
1041
|
-
* @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead.
|
1042
|
-
*/
|
1043
|
-
export function isString(object: unknown): object is string;
|
1044
|
-
/**
|
1045
|
-
* Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`.
|
1046
|
-
*
|
1047
|
-
* ```js
|
1048
|
-
* import util from 'node:util';
|
1049
|
-
*
|
1050
|
-
* util.isSymbol(5);
|
1051
|
-
* // Returns: false
|
1052
|
-
* util.isSymbol('foo');
|
1053
|
-
* // Returns: false
|
1054
|
-
* util.isSymbol(Symbol('foo'));
|
1055
|
-
* // Returns: true
|
1056
|
-
* ```
|
1057
|
-
* @since v0.11.5
|
1058
|
-
* @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead.
|
1059
|
-
*/
|
1060
|
-
export function isSymbol(object: unknown): object is symbol;
|
1061
|
-
/**
|
1062
|
-
* Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`.
|
1063
|
-
*
|
1064
|
-
* ```js
|
1065
|
-
* import util from 'node:util';
|
1066
|
-
*
|
1067
|
-
* const foo = undefined;
|
1068
|
-
* util.isUndefined(5);
|
1069
|
-
* // Returns: false
|
1070
|
-
* util.isUndefined(foo);
|
1071
|
-
* // Returns: true
|
1072
|
-
* util.isUndefined(null);
|
1073
|
-
* // Returns: false
|
1074
|
-
* ```
|
1075
|
-
* @since v0.11.5
|
1076
|
-
* @deprecated Since v4.0.0 - Use `value === undefined` instead.
|
1077
|
-
*/
|
1078
|
-
export function isUndefined(object: unknown): object is undefined;
|
1079
790
|
/**
|
1080
791
|
* The `util.deprecate()` method wraps `fn` (which may be a function or class) in
|
1081
792
|
* such a way that it is marked as deprecated.
|
@@ -1320,7 +1031,7 @@ declare module "util" {
|
|
1320
1031
|
* ```
|
1321
1032
|
*
|
1322
1033
|
* If there is an `original[util.promisify.custom]` property present, `promisify`
|
1323
|
-
* will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-
|
1034
|
+
* will return its value, see [Custom promisified functions](https://nodejs.org/docs/latest-v24.x/api/util.html#custom-promisified-functions).
|
1324
1035
|
*
|
1325
1036
|
* `promisify()` assumes that `original` is a function taking a callback as its
|
1326
1037
|
* final argument in all cases. If `original` is not a function, `promisify()`
|
@@ -1517,7 +1228,7 @@ declare module "util" {
|
|
1517
1228
|
* );
|
1518
1229
|
* ```
|
1519
1230
|
*
|
1520
|
-
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-
|
1231
|
+
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v24.x/api/util.html#modifiers).
|
1521
1232
|
* @param format A text format or an Array of text formats defined in `util.inspect.colors`.
|
1522
1233
|
* @param text The text to to be formatted.
|
1523
1234
|
* @since v20.12.0
|
@@ -2221,23 +1932,21 @@ declare module "util/types" {
|
|
2221
1932
|
* ```
|
2222
1933
|
*
|
2223
1934
|
* For further information on `napi_create_external`, refer to
|
2224
|
-
* [`napi_create_external()`](https://nodejs.org/docs/latest-
|
1935
|
+
* [`napi_create_external()`](https://nodejs.org/docs/latest-v24.x/api/n-api.html#napi_create_external).
|
2225
1936
|
* @since v10.0.0
|
2226
1937
|
*/
|
2227
1938
|
function isExternal(object: unknown): boolean;
|
2228
1939
|
/**
|
2229
|
-
* Returns `true` if the value is a built-in `Float16Array` instance.
|
1940
|
+
* Returns `true` if the value is a built-in [`Float16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float16Array) instance.
|
2230
1941
|
*
|
2231
1942
|
* ```js
|
2232
1943
|
* util.types.isFloat16Array(new ArrayBuffer()); // Returns false
|
2233
1944
|
* util.types.isFloat16Array(new Float16Array()); // Returns true
|
2234
1945
|
* util.types.isFloat16Array(new Float32Array()); // Returns false
|
2235
1946
|
* ```
|
2236
|
-
* @since
|
1947
|
+
* @since v24.0.0
|
2237
1948
|
*/
|
2238
|
-
|
2239
|
-
// The Float16Array feature does not yet exist in this version of Node.js.
|
2240
|
-
function isFloat16Array(object: unknown): boolean;
|
1949
|
+
function isFloat16Array(object: unknown): object is Float16Array;
|
2241
1950
|
/**
|
2242
1951
|
* Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance.
|
2243
1952
|
*
|
@@ -4,7 +4,7 @@
|
|
4
4
|
* ```js
|
5
5
|
* import v8 from 'node:v8';
|
6
6
|
* ```
|
7
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
7
|
+
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/v8.js)
|
8
8
|
*/
|
9
9
|
declare module "v8" {
|
10
10
|
import { Readable } from "node:stream";
|
@@ -400,39 +400,6 @@ declare module "v8" {
|
|
400
400
|
* @since v12.8.0
|
401
401
|
*/
|
402
402
|
function getHeapCodeStatistics(): HeapCodeStatistics;
|
403
|
-
/**
|
404
|
-
* V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
|
405
|
-
* If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
|
406
|
-
* otherwise, it returns false.
|
407
|
-
*
|
408
|
-
* If this method returns false, that does not mean that the string contains some characters not in `Latin-1/ISO-8859-1`.
|
409
|
-
* Sometimes a `Latin-1` string may also be represented as `UTF16`.
|
410
|
-
*
|
411
|
-
* ```js
|
412
|
-
* const { isStringOneByteRepresentation } = require('node:v8');
|
413
|
-
*
|
414
|
-
* const Encoding = {
|
415
|
-
* latin1: 1,
|
416
|
-
* utf16le: 2,
|
417
|
-
* };
|
418
|
-
* const buffer = Buffer.alloc(100);
|
419
|
-
* function writeString(input) {
|
420
|
-
* if (isStringOneByteRepresentation(input)) {
|
421
|
-
* buffer.writeUint8(Encoding.latin1);
|
422
|
-
* buffer.writeUint32LE(input.length, 1);
|
423
|
-
* buffer.write(input, 5, 'latin1');
|
424
|
-
* } else {
|
425
|
-
* buffer.writeUint8(Encoding.utf16le);
|
426
|
-
* buffer.writeUint32LE(input.length * 2, 1);
|
427
|
-
* buffer.write(input, 5, 'utf16le');
|
428
|
-
* }
|
429
|
-
* }
|
430
|
-
* writeString('hello');
|
431
|
-
* writeString('你好');
|
432
|
-
* ```
|
433
|
-
* @since v22.15.0
|
434
|
-
*/
|
435
|
-
function isStringOneByteRepresentation(content: string): boolean;
|
436
403
|
/**
|
437
404
|
* @since v8.0.0
|
438
405
|
*/
|
@@ -580,8 +547,7 @@ declare module "v8" {
|
|
580
547
|
function stopCoverage(): void;
|
581
548
|
/**
|
582
549
|
* The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once.
|
583
|
-
* `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-
|
584
|
-
* @experimental
|
550
|
+
* `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v24.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
|
585
551
|
* @since v18.10.0, v16.18.0
|
586
552
|
*/
|
587
553
|
function setHeapSnapshotNearHeapLimit(limit: number): void;
|
@@ -807,33 +773,6 @@ declare module "v8" {
|
|
807
773
|
*/
|
808
774
|
const promiseHooks: PromiseHooks;
|
809
775
|
type StartupSnapshotCallbackFn = (args: any) => any;
|
810
|
-
interface StartupSnapshot {
|
811
|
-
/**
|
812
|
-
* Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit.
|
813
|
-
* This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization.
|
814
|
-
* @since v18.6.0, v16.17.0
|
815
|
-
*/
|
816
|
-
addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
817
|
-
/**
|
818
|
-
* Add a callback that will be called when the Node.js instance is deserialized from a snapshot.
|
819
|
-
* The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or
|
820
|
-
* to re-acquire resources that the application needs when the application is restarted from the snapshot.
|
821
|
-
* @since v18.6.0, v16.17.0
|
822
|
-
*/
|
823
|
-
addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
824
|
-
/**
|
825
|
-
* This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script.
|
826
|
-
* If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized
|
827
|
-
* data (if provided), otherwise an entry point script still needs to be provided to the deserialized application.
|
828
|
-
* @since v18.6.0, v16.17.0
|
829
|
-
*/
|
830
|
-
setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void;
|
831
|
-
/**
|
832
|
-
* Returns true if the Node.js instance is run to build a snapshot.
|
833
|
-
* @since v18.6.0, v16.17.0
|
834
|
-
*/
|
835
|
-
isBuildingSnapshot(): boolean;
|
836
|
-
}
|
837
776
|
/**
|
838
777
|
* The `v8.startupSnapshot` interface can be used to add serialization and deserialization hooks for custom startup snapshots.
|
839
778
|
*
|
@@ -912,10 +851,35 @@ declare module "v8" {
|
|
912
851
|
*
|
913
852
|
* Currently the application deserialized from a user-land snapshot cannot be snapshotted again, so these APIs are only available to applications that are not deserialized from a user-land snapshot.
|
914
853
|
*
|
915
|
-
* @experimental
|
916
854
|
* @since v18.6.0, v16.17.0
|
917
855
|
*/
|
918
|
-
|
856
|
+
namespace startupSnapshot {
|
857
|
+
/**
|
858
|
+
* Add a callback that will be called when the Node.js instance is about to get serialized into a snapshot and exit.
|
859
|
+
* This can be used to release resources that should not or cannot be serialized or to convert user data into a form more suitable for serialization.
|
860
|
+
* @since v18.6.0, v16.17.0
|
861
|
+
*/
|
862
|
+
function addSerializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
863
|
+
/**
|
864
|
+
* Add a callback that will be called when the Node.js instance is deserialized from a snapshot.
|
865
|
+
* The `callback` and the `data` (if provided) will be serialized into the snapshot, they can be used to re-initialize the state of the application or
|
866
|
+
* to re-acquire resources that the application needs when the application is restarted from the snapshot.
|
867
|
+
* @since v18.6.0, v16.17.0
|
868
|
+
*/
|
869
|
+
function addDeserializeCallback(callback: StartupSnapshotCallbackFn, data?: any): void;
|
870
|
+
/**
|
871
|
+
* This sets the entry point of the Node.js application when it is deserialized from a snapshot. This can be called only once in the snapshot building script.
|
872
|
+
* If called, the deserialized application no longer needs an additional entry point script to start up and will simply invoke the callback along with the deserialized
|
873
|
+
* data (if provided), otherwise an entry point script still needs to be provided to the deserialized application.
|
874
|
+
* @since v18.6.0, v16.17.0
|
875
|
+
*/
|
876
|
+
function setDeserializeMainFunction(callback: StartupSnapshotCallbackFn, data?: any): void;
|
877
|
+
/**
|
878
|
+
* Returns true if the Node.js instance is run to build a snapshot.
|
879
|
+
* @since v18.6.0, v16.17.0
|
880
|
+
*/
|
881
|
+
function isBuildingSnapshot(): boolean;
|
882
|
+
}
|
919
883
|
}
|
920
884
|
declare module "node:v8" {
|
921
885
|
export * from "v8";
|